%pylab inline
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
from scipy.optimize import curve_fit
from scipy import stats
from matplotlib.font_manager import FontProperties
from fractions import Fraction
import os
ResultsFolder='/Users/burbol2/Dropbox/Apps/Computable/Final_Results_CAngles'
FolderForPlots='/Users/burbol2/Dropbox/Apps/Computable/Final_Results_CAngles/DiplomResults/BeforeDiplomResults'
ptensor=[159.2056245, 124.1571, 101.59361114, 74.64618236, 0., 0., 0.] #results with pressure tensor
percentages = [0, 5, 11, 17, 33, 50,66]
Waters=[1000, 2000, 3000, 4000, 5000, 6500, 7000, 8000, 9000, 10000]
mac_theta_w = np.zeros(len(percentages))
sigma_w = np.zeros(len(percentages))
mac_theta_m = np.zeros(len(percentages))
sigma_m = np.zeros(len(percentages))
mac_theta_s = np.zeros(len(percentages))
sigma_s = np.zeros(len(percentages))
# In the following dictionaries we will save the raw input data
angles_w = {}
radii_w = {}
angles_m = {}
radii_m = {}
angles_s = {}
radii_s = {}
# In the following dictionaries we will save the results for the cos(theta) and 1/r_base, and their errorbars.
# We will call them the "results-dictionaries"
theta_w = {}
rbase_w = {}
errortheta_w = {}
error_rbase_w = {}
start_theta_w = {}
end_theta_w = {}
start_rbase_w = {}
end_rbase_w = {}
equil_theta_w = {}
equil_rbase_w = {}
theta_m = {}
rbase_m = {}
errortheta_m = {}
error_rbase_m = {}
start_theta_m = {}
end_theta_m = {}
start_rbase_m = {}
end_rbase_m = {}
equil_theta_m = {}
equil_rbase_m = {}
theta_s = {}
rbase_s = {}
errortheta_s = {}
error_rbase_s = {}
start_theta_s = {}
end_theta_s = {}
start_rbase_s = {}
end_rbase_s = {}
equil_theta_s = {}
equil_rbase_s = {}
# For each surface we will store 10 results corresponding to the 10 droplets in each system. This means that in every
# entry of the "results-dictionaries" we will store a list of 10 elements. Thus, now we store in them lists with 10 zeros.
for system in percentages:
theta_w[system] = []
rbase_w[system] = []
errortheta_w[system] = []
error_rbase_w[system] = []
start_theta_w[system] = []
end_theta_w[system] = []
start_rbase_w[system] = []
end_rbase_w[system] = []
equil_theta_w[system] = []
equil_rbase_w[system] = []
theta_m[system] = []
rbase_m[system] = []
errortheta_m[system] = []
error_rbase_m[system] = []
start_theta_m[system] = []
end_theta_m[system] = []
start_rbase_m[system] = []
end_rbase_m[system] = []
equil_theta_m[system] = []
equil_rbase_m[system] = []
theta_s[system] = []
rbase_s[system] = []
errortheta_s[system] = []
error_rbase_s[system] = []
start_theta_s[system] = []
end_theta_s[system] = []
start_rbase_s[system] = []
end_rbase_s[system] = []
equil_theta_s[system] = []
equil_rbase_s[system] = []
# We create an array named "t" with the time values. We use the length of the longest simulation.
maxlength=100 #maximum length in ns
t = np.zeros(2*maxlength)
i=0
for d in frange(0, maxlength, 0.5,closed=0):
t[i] = d
i = i + 1
# We save the data in the arrays "theta_all" and "rbase_all"
SAMs=[0,5,11,17,33] # Here we use only the SAMs with Contact Angles. Not the systems with complete wetting.
# Here we create two dictionaries named "angles" and "radii". Each dictionary consists of a set of "key: value" pairs, each one corresponding to a different system. The keys are (also) a pair of numbers "b, c".
# "b" refers to the OH-coverage percentage of the SAM, and "c" to the number of water molecules of the droplet. For example, the key "5, 1000" refers to the system with a surface with 5% OH-coverage,
# and a droplet with 1000 water molecules. The value corresponding to each key is an array with the 40 calculated angles/base radii, that belong to that system. For example: "radii[(11, 3000)]" would give back
# the array with the 40 calculated values of the base radii corresponding to the system with a surface with 11% OH-coverage, and a droplet with 3000 water molecules.
os.chdir(ResultsFolder)
for b in SAMs:
theta_data_w, rbase_data_w = np.loadtxt('Contact_Angles2_WaterPeak_s'+str(b)+'.txt', skiprows=2, usecols = (0,1),unpack=True)
theta_data_m, rbase_data_m = np.loadtxt('Contact_Angles2_MiddlePoint_s'+str(b)+'.txt', skiprows=2, usecols = (0,1),unpack=True)
#theta_data_m, rbase_data_m = np.loadtxt('Contact_Angles2_GDS_s'+str(b)+'.txt', skiprows=2, usecols = (0,1),unpack=True)
theta_data_s, rbase_data_s = np.loadtxt('Contact_Angles2_SAMPeak_s'+str(b)+'.txt', skiprows=2, usecols = (0,1),unpack=True)
k = 0
for c in Waters:
# First data with z=0 at the first water peak
z = b, c
th_w = [0] *(2*maxlength)
r_w = [0] *(2*maxlength)
th_m = [0] *(2*maxlength)
r_m = [0] *(2*maxlength)
th_s = [0] *(2*maxlength)
r_s = [0] *(2*maxlength)
i=k*(2*maxlength)
j=(k+1)*(2*maxlength)
#print "z=", z, "i=", i, "j=", j
m = 0
for l in range(i,j):
th_w[m]=theta_data_w[l]
r_w[m]=rbase_data_w[l]
m = m +1
angles_w[z] = th_w
radii_w[z] = r_w
m = 0
for l in range(i,j):
th_m[m]=theta_data_m[l]
r_m[m]=rbase_data_m[l]
m = m +1
angles_m[z] = th_m
radii_m[z] = r_m
m = 0
for l in range(i,j):
th_s[m]=theta_data_s[l]
r_s[m]=rbase_data_s[l]
m = m +1
angles_s[z] = th_s
radii_s[z] = r_s
k=k+1
os.chdir(FolderForPlots)
z=33,8000
w=11
print angles_w[z][w]
print angles_m[z][w]
print angles_s[z][w]
print radii_w[z][w]
print radii_m[z][w]
print radii_s[z][w]
# func is the function of a line, that will be used in the linear fits
def func(x, a, b):
return a*x + b
#endpoint returns the integer "end": the last data point different then "nan"
def endpoint(theta):
for end in range(20, len(theta)):
if math.isnan(theta[end]):
break
return end
# The following functions will be used to calculate the block averages and the errorbars
# The function naive_variance will only be used inside the function blockAverage
def naive_variance(data):
n = 0
Sum = 0
Sum_sqr = 0
for x in data:
n = n + 1
Sum = Sum + x
Sum_sqr = Sum_sqr + x*x
variance = (Sum_sqr - (Sum*Sum)/n)/(n - 1)
return variance
def blockAverage(datastream, Nblocks):
# FIRST WE CREATE AN ARRAY TO STORE THE MEAN VALUES OF THE DATA BLOCKS (blockMean)
blockMean = np.zeros(Nblocks)
# Nobs is the number of points (observations) in our data
Nobs = len(datastream)
# BlockSize is the size of each block of data
BlockSize = int(Nobs//Nblocks)
#print "BlockSize=", BlockSize
if Nblocks==1:
errorbar = naive_variance(datastream)
return errorbar
else:
# WE CALCULATE IN A LOOP THE MEAN VALUES OF EACH DATA BLOCK (blockMean)
for i in range(0,Nblocks-1):
ibeg = i*BlockSize
iend = (i+1)*BlockSize
blockMean[i] = mean(datastream[ibeg:iend])
# WE TREAT THE LAST BLOCK SEPARATELY, BECAUSE WE HAVE TO TAKE INTO ACCOUNT THE POSSIBLE REMAINING POINTS
# WHEN THE NUMBER OF DATA POINTS ISN'T A MULTIPLE OF THE NUMBER OF BLOCKS
#print "Last block"
ibeg = (Nblocks-1)*BlockSize
iend = Nobs
blockMean[Nblocks-1] = mean(datastream[ibeg:iend])
errorbar = (np.std(blockMean))/sqrt(Nblocks -1) #np.std(blockMean) is the standard deviation of blockMean
simulavr = mean(blockMean)
return simulavr, errorbar
#best_start SEARCHS FOR THE STARTING POINT (start) OF BIGGEST TIME INTERVAL where the error interval is smaller then the variation of the data (controlled
# with a line fit of the data
def best_start(theta,t,omitstart,fixend):
lastnumber = endpoint(theta)
endblocks = lastnumber - fixend
error = np.zeros(endblocks-omitstart) #error will be the total error (of all the points taken each time we choose a different set of data to make the blocks)
average = np.zeros(endblocks-omitstart) # average is the same, but for the average
slope = np.zeros(endblocks-omitstart)
intercept = np.zeros(endblocks-omitstart)
shift = np.zeros(endblocks-omitstart)
goodblocks = []
error = error.tolist()
j=0
# Loop for finding the "best" interval to do the block averaging
for i in range (omitstart, endblocks):
average[j],error[j] = blockAverage((theta[i:lastnumber]),3)
slope[j], intercept[j], delete1, delete2, delete3 = stats.linregress(t[i:lastnumber],theta[i:lastnumber])
shift[j] = abs(func(t[i], slope[j], intercept[j]) - func(t[lastnumber], slope[j], intercept[j]))
if shift[j] <= (2*error[j]):
goodblocks.append(i)
#print "i=",i, "shift=",shift[j], "error=",2*error[j]
j = j+1
if goodblocks==[]:
#print "not equilibrated yet"
return None
else:
#start = min(goodblocks)+ omitstart
print "num of good intervals=", len(goodblocks)
start = min(goodblocks)
return start
'''
For adjusting the subplots:
subplots_adjust(left=None, bottom=None, right=None, top=None, wspace=None, hspace=None)
left = 0.125 # the left side of the subplots of the figure
right = 0.9 # the right side of the subplots of the figure
bottom = 0.1 # the bottom of the subplots of the figure
top = 0.9 # the top of the subplots of the figure
wspace = 0.2 # the amount of width reserved for blank space between subplots
hspace = 0.2 # the amount of height reserved for white space between subplots
********************************************************************
For adjusting the legend box:
Padding and spacing between various elements use following
keywords parameters. These values are measure in font-size
units. E.g., a fontsize of 10 points and a handlelength=5
implies a handlelength of 50 points. Values from rcParams
will be used if None.
=====================================================================
Keyword | Description
=====================================================================
borderpad the fractional whitespace inside the legend border
labelspacing the vertical space between the legend entries
handlelength the length of the legend handles
handletextpad the pad between the legend handle and text
borderaxespad the pad between the axes and legend border
columnspacing the spacing between columns
'''
#function copied from internet to plot with axes in radians
def create_pi_labels(a, b, step):
max_denominator = int(1/step)
# i added this line and the .limit_denominator to solve an
# issue with floating point precision
# because of floataing point precision Fraction(1/3) would be
# Fraction(6004799503160661, 18014398509481984)
values = np.arange(a, b+step/10, step)
fracs = [Fraction(x).limit_denominator(max_denominator) for x in values]
ticks = values*np.pi
labels = []
for frac in fracs:
if frac.numerator==0:
labels.append(r"$0$")
elif frac.numerator<0:
if frac.denominator==1 and abs(frac.numerator)==1:
labels.append(r"$-\pi$")
elif frac.denominator==1:
labels.append(r"$-{}\pi$".format(abs(frac.numerator)))
else:
labels.append(r"$-\frac{{{}}}{{{}}} \pi$".format(abs(frac.numerator), frac.denominator))
else:
if frac.denominator==1 and frac.numerator==1:
labels.append(r"$\pi$")
elif frac.denominator==1:
labels.append(r"${}\pi$".format(frac.numerator))
else:
labels.append(r"$\frac{{{}}}{{{}}} \pi$".format(frac.numerator, frac.denominator))
return ticks, labels
#from matplotlib import font_manager
#font_manager.OSXInstalledFonts()
#print mpl.font_manager.OSXFontDirectories
b=0
minblocksize=20 # The minimum block size is 10ns=20 points
beg = 10 # We leave out the first 5ns=10 points
blocksNum=3 #the function best_start uses also 3 blocks for averaging
i = 0
for c in [2000]:
n=Waters.index(c)
theta2 = array(angles_w[(b, c)])
end=endpoint(theta2)
start=best_start(theta2,t,beg,minblocksize)
print 'start=',start
slope, intercept, delete1, delete2, delete3 = stats.linregress(t[start:end],theta2[start:end])
thetamean, errrorbar =blockAverage((theta2[start:end]),blocksNum)
print "for SAM ",b,"% and ", c, " molecules:"
if start == None:
print " Not equilibrated!"
sampling = 0
start = beg
end = endpoint(theta2)
symb='<'
else:
sampling = (end-start)/2.
print "start point=", start, "length of sampling =", sampling, "ns"
print "slope=", slope, "intercept=",intercept
print "average=",thetamean, "error=",errrorbar
symb='>'
m=str(round(slope*(end-start)/2,3))
print('error '+str(round(2*errrorbar,3))+' deg '+symb + m + ' deg (shift)')
b=0
minblocksize=20 # The minimum block size is 10ns=20 points
beg = 10 # We leave out the first 5ns=10 points
blocksNum=3 #the function best_start uses also 3 blocks for averaging
Nrows = 5
Ncolumns = 2
fig, ax = plt.subplots(Ncolumns, Nrows)
#fig.subplots_adjust(bottom=0.5,top=2.5, left=0.0, right=1.5, hspace = 0.5)
fig.subplots_adjust(bottom=0.0,top=4.5, left=0.0, right=1.5, hspace = 0.35)
matplotlib.rcParams['legend.handlelength'] = 0
matplotlib.rcParams['legend.markerscale'] = 0
matplotlib.rcParams['legend.handletextpad'] = 0
matplotlib.rcParams['legend.markerscale'] = 2
#matplotlib.rcParams['font.family'] = 'Times New Roman'
#matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
errortheta_w[b]=[]
theta_w[b]=[]
start_theta_w[b]=[]
end_theta_w[b]=[]
equil_theta_w[b]=[]
i = 0
for c in Waters:
#for c in [1000]:
n=Waters.index(c)
theta2 = array(angles_w[(b, c)])
end=endpoint(theta2)
start=best_start(theta2,t,beg,minblocksize)
slope, intercept, delete1, delete2, delete3 = stats.linregress(t[start:end],theta2[start:end])
thetamean, errrorbar =blockAverage((theta2[start:end]),blocksNum)
print "for SAM ",b,"% and ", c, " molecules:"
if start == None:
print " Not equilibrated!"
sampling = 0
start = beg
end = endpoint(theta2)
symb='<'
else:
sampling = (end-start)/2.
print "start point=", start, "length of sampling =", sampling, "ns"
print "slope=", slope, "intercept=",intercept
print "average=",thetamean, "error=",errrorbar
symb='>'
ax = plt.subplot(Nrows, Ncolumns, i+1)
m=str(round(abs(slope)*(end-start)/2.,3))
line1, = ax.plot(t[start:end], func(t[start:end], slope, intercept),'r', label='error '+str(round(2*errrorbar,3))+'$^\circ $'+symb+m+'$^\circ $ shift')
ax.plot(t[start:end], theta2[start:end],'-',linewidth=0.5)
ax.plot(t[start:end], func(t[start:end], 0, thetamean))
ax.plot(t[start:end], func(t[start:end], 0, thetamean+errrorbar),'g-')
ax.plot(t[start:end], func(t[start:end], 0, thetamean-errrorbar),'g-')
matplotlib.rcParams['font.family'] = 'Arial'
# Set common labels
ax.set_xlabel('time [ns]',fontsize=13)
plt.ylabel(r'$\theta_{mic}$ [deg]',fontsize=14)
#ax.set_ylabel(r'R$\ _{BASE} $ [nm]')
#titles for each subplot:
matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
#####ax.set_title(str(c)+' water molec: $\Delta(t)=$'+str(sampling)+'ns')
ax.set_title(str(c)+' water molec: $\Delta(t)=$'+str(sampling)+'ns',fontweight='bold',fontsize=15)
matplotlib.rcParams['font.family'] = 'Arial'
# Create a legend for the first line.
#first_legend = plt.legend(handles=[line1],bbox_to_anchor=(0.2, 0.9), loc=3,borderaxespad=0.,borderpad=0.2,fontsize=11)
first_legend = plt.legend(loc=1,borderaxespad=0.,borderpad=0.2,fontsize=11)
# Add the legend manually to the current Axes.
ax = plt.gca().add_artist(first_legend)
# SAVING RESULTS
if sampling != 0:
(errortheta_w[b]).append(errrorbar)
(theta_w[b]).append(thetamean)
(start_theta_w[b]).append(start)
(end_theta_w[b]).append(end)
(equil_theta_w[b]).append(c)
i = i+1
matplotlib.rcParams['font.family'] = 'Times New Roman'
mytitle = plt.suptitle(r'Contact Angle $\theta_{mic}$ vs. Time for SAM'+str(b)+'%', fontsize=19, fontweight='bold',x=0.7, y=4.65)
###mytitle = plt.suptitle(r'Contact Angle $\theta_{mic}$ vs. Time for SAM'+str(b)+'%', fontsize=17,x=0.7, y=4.65)
plt.show()
fig.savefig('equil_theta_t_s'+str(b)+'.jpg',bbox_extra_artists=(first_legend,mytitle,), bbox_inches='tight')
# check for better quality:
# plt.savefig('destination_path.eps', format='eps', dpi=1000)
b=0
minblocksize=20 # The minimum block size is 10ns=20 points
beg = 10 # We leave out the first 5ns=10 points
blocksNum=3 #the function best_start uses also 3 blocks for averaging
Nrows = 5
Ncolumns = 2
fig, ax = plt.subplots(Ncolumns, Nrows)
#fig.subplots_adjust(bottom=0.5,top=2.5, left=0.0, right=1.5, hspace = 0.5)
fig.subplots_adjust(bottom=0.0,top=4.5, left=0.0, right=1.5, hspace = 0.35)
matplotlib.rcParams['legend.handlelength'] = 0
matplotlib.rcParams['legend.markerscale'] = 0
matplotlib.rcParams['legend.handletextpad'] = 0
matplotlib.rcParams['legend.markerscale'] = 2
#matplotlib.rcParams['font.family'] = 'Times New Roman'
#matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
errortheta_m[b]=[]
theta_m[b]=[]
start_theta_m[b]=[]
end_theta_m[b]=[]
equil_theta_m[b]=[]
errortheta_s[b]=[]
theta_s[b]=[]
start_theta_s[b]=[]
end_theta_s[b]=[]
equil_theta_s[b]=[]
i = 0
for c in Waters:
#for c in [1000]:
print c," molec:"
n=Waters.index(c)
theta2_w = array(angles_w[(b, c)])
theta2_m = array(angles_m[(b, c)])
theta2_s = array(angles_s[(b, c)])
end=endpoint(theta2_m)
start=best_start(theta2_m,t,beg,minblocksize)
thetamean, errrorbar =blockAverage((theta2_m[start:end]),blocksNum)
# SAVING RESULTS
if start != None:
(errortheta_m[b]).append(errrorbar)
(theta_m[b]).append(thetamean)
(start_theta_m[b]).append(start)
(end_theta_m[b]).append(end)
(equil_theta_m[b]).append(c)
end=endpoint(theta2_s)
start=best_start(theta2_s,t,beg,minblocksize)
thetamean, errrorbar =blockAverage((theta2_s[start:end]),blocksNum)
# SAVING RESULTS
if start != None:
(errortheta_s[b]).append(errrorbar)
(theta_s[b]).append(thetamean)
(start_theta_s[b]).append(start)
(end_theta_s[b]).append(end)
(equil_theta_s[b]).append(c)
ax = plt.subplot(Nrows, Ncolumns, i+1)
####line1, = ax.plot(t, theta2_w,'-',linewidth=0.5)
#ax.plot(t, theta2_w,'-',linewidth=0.5)
#ax.plot(t, theta2_m,'-',linewidth=0.5)
#ax.plot(t, theta2_s,'-',linewidth=0.5)
mylines=ax.plot(t, theta2_w,'o', t, theta2_m, 'o', t,theta2_s,'o')
plt.setp(mylines, markersize=3.0)
matplotlib.rcParams['font.family'] = 'Arial'
# Set common labels
ax.set_xlabel('time [ns]',fontsize=13)
plt.ylabel(r'$\theta_{mic}$ [deg]',fontsize=14)
#ax.set_ylabel(r'R$\ _{BASE} $ [nm]')
#titles for each subplot:
matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
#####ax.set_title(str(c)+' water molec: $\Delta(t)=$'+str(sampling)+'ns')
ax.set_title(str(c)+' water molec.',fontweight='bold',fontsize=15)
matplotlib.rcParams['font.family'] = 'Arial'
i = i+1
matplotlib.rcParams['font.family'] = 'Times New Roman'
mytitle = plt.suptitle(r'Contact Angle $\theta_{mic}$ vs. Time for SAM'+str(b)+'%', fontsize=19, fontweight='bold',x=0.7, y=4.65)
###mytitle = plt.suptitle(r'Contact Angle $\theta_{mic}$ vs. Time for SAM'+str(b)+'%', fontsize=17,x=0.7, y=4.65)
plt.show()
fig.savefig('theta_t_s'+str(b)+'.jpg',bbox_extra_artists=(first_legend,mytitle,), bbox_inches='tight')
# check for better quality:
# plt.savefig('destination_path.eps', format='eps', dpi=1000)
b=5
minblocksize=20 # The minimum block size is 10ns=20 points
beg = 10 # We leave out the first 5ns=10 points
blocksNum=3 #the function best_start uses also 3 blocks for averaging
Nrows = 5
Ncolumns = 2
fig, ax = plt.subplots(Ncolumns, Nrows)
#fig.subplots_adjust(bottom=0.5,top=2.5, left=0.0, right=1.5, hspace = 0.5)
fig.subplots_adjust(bottom=0.0,top=4.5, left=0.0, right=1.5, hspace = 0.35)
matplotlib.rcParams['legend.handlelength'] = 0
matplotlib.rcParams['legend.markerscale'] = 0
matplotlib.rcParams['legend.handletextpad'] = 0
matplotlib.rcParams['legend.markerscale'] = 2
#matplotlib.rcParams['font.family'] = 'Times New Roman'
#matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
errortheta_w[b]=[]
theta_w[b]=[]
start_theta_w[b]=[]
end_theta_w[b]=[]
equil_theta_w[b]=[]
i = 0
for c in Waters:
#for c in [1000]:
n=Waters.index(c)
theta2 = array(angles_w[(b, c)])
end=endpoint(theta2)
start=best_start(theta2,t,beg,minblocksize)
slope, intercept, delete1, delete2, delete3 = stats.linregress(t[start:end],theta2[start:end])
thetamean, errrorbar =blockAverage((theta2[start:end]),blocksNum)
print "for SAM ",b,"% and ", c, " molecules:"
if start == None:
print " Not equilibrated!"
sampling = 0
start = beg
end = endpoint(theta2)
symb='<'
else:
sampling = (end-start)/2.
print "start point=", start, "length of sampling =", sampling, "ns"
print "slope=", slope, "intercept=",intercept
print "average=",thetamean, "error=",errrorbar
symb='>'
ax = plt.subplot(Nrows, Ncolumns, i+1)
m=str(round(abs(slope)*(end-start)/2.,3))
line1, = ax.plot(t[start:end], func(t[start:end], slope, intercept),'r', label='error '+str(round(2*errrorbar,3))+'$^\circ $'+symb+m+'$^\circ $ shift')
ax.plot(t[start:end], theta2[start:end],'-',linewidth=0.5)
#ax.plot(t, theta2,'-',linewidth=0.5)
ax.plot(t[start:end], func(t[start:end], 0, thetamean))
ax.plot(t[start:end], func(t[start:end], 0, thetamean+errrorbar),'g-')
ax.plot(t[start:end], func(t[start:end], 0, thetamean-errrorbar),'g-')
matplotlib.rcParams['font.family'] = 'Arial'
# Set common labels
ax.set_xlabel('time [ns]',fontsize=13)
plt.ylabel(r'$\theta_{mic}$ [deg]',fontsize=14)
#ax.set_ylabel(r'R$\ _{BASE} $ [nm]')
#titles for each subplot:
matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
#####ax.set_title(str(c)+' water molec: $\Delta(t)=$'+str(sampling)+'ns')
ax.set_title(str(c)+' water molec: $\Delta(t)=$'+str(sampling)+'ns',fontweight='bold',fontsize=15)
matplotlib.rcParams['font.family'] = 'Arial'
# Create a legend for the first line.
#first_legend = plt.legend(handles=[line1],bbox_to_anchor=(0.2, 0.9), loc=3,borderaxespad=0.,borderpad=0.2,fontsize=11)
first_legend = plt.legend(loc=1,borderaxespad=0.,borderpad=0.2,fontsize=11)
# Add the legend manually to the current Axes.
ax = plt.gca().add_artist(first_legend)
# SAVING RESULTS
if sampling != 0:
(errortheta_w[b]).append(errrorbar)
(theta_w[b]).append(thetamean)
(start_theta_w[b]).append(start)
(end_theta_w[b]).append(end)
(equil_theta_w[b]).append(c)
i = i+1
matplotlib.rcParams['font.family'] = 'Times New Roman'
mytitle = plt.suptitle(r'Contact Angle $\theta_{mic}$ vs. Time for SAM'+str(b)+'%', fontsize=19, fontweight='bold',x=0.7, y=4.65)
###mytitle = plt.suptitle(r'Contact Angle $\theta_{mic}$ vs. Time for SAM'+str(b)+'%', fontsize=17,x=0.7, y=4.65)
plt.show()
fig.savefig('equil_theta_t_s'+str(b)+'.jpg',bbox_extra_artists=(first_legend,mytitle,), bbox_inches='tight')
# check for better quality:
# plt.savefig('destination_path.eps', format='eps', dpi=1000)
b=5
minblocksize=20 # The minimum block size is 10ns=20 points
beg = 10 # We leave out the first 5ns=10 points
blocksNum=3 #the function best_start uses also 3 blocks for averaging
Nrows = 5
Ncolumns = 2
fig, ax = plt.subplots(Ncolumns, Nrows)
#fig.subplots_adjust(bottom=0.5,top=2.5, left=0.0, right=1.5, hspace = 0.5)
fig.subplots_adjust(bottom=0.0,top=4.5, left=0.0, right=1.5, hspace = 0.35)
matplotlib.rcParams['legend.handlelength'] = 0
matplotlib.rcParams['legend.markerscale'] = 0
matplotlib.rcParams['legend.handletextpad'] = 0
matplotlib.rcParams['legend.markerscale'] = 2
#matplotlib.rcParams['font.family'] = 'Times New Roman'
#matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
errortheta_m[b]=[]
theta_m[b]=[]
start_theta_m[b]=[]
end_theta_m[b]=[]
equil_theta_m[b]=[]
errortheta_s[b]=[]
theta_s[b]=[]
start_theta_s[b]=[]
end_theta_s[b]=[]
equil_theta_s[b]=[]
i = 0
for c in Waters:
#for c in [1000]:
print c," molec:"
n=Waters.index(c)
theta2_w = array(angles_w[(b, c)])
theta2_m = array(angles_m[(b, c)])
theta2_s = array(angles_s[(b, c)])
end=endpoint(theta2_m)
start=best_start(theta2_m,t,beg,minblocksize)
thetamean, errrorbar =blockAverage((theta2_m[start:end]),blocksNum)
# SAVING RESULTS
if start != None:
(errortheta_m[b]).append(errrorbar)
(theta_m[b]).append(thetamean)
(start_theta_m[b]).append(start)
(end_theta_m[b]).append(end)
(equil_theta_m[b]).append(c)
end=endpoint(theta2_s)
start=best_start(theta2_s,t,beg,minblocksize)
thetamean, errrorbar =blockAverage((theta2_s[start:end]),blocksNum)
# SAVING RESULTS
if start != None:
(errortheta_s[b]).append(errrorbar)
(theta_s[b]).append(thetamean)
(start_theta_s[b]).append(start)
(end_theta_s[b]).append(end)
(equil_theta_s[b]).append(c)
ax = plt.subplot(Nrows, Ncolumns, i+1)
####line1, = ax.plot(t, theta2_w,'-',linewidth=0.5)
#ax.plot(t, theta2_w,'-',linewidth=0.5)
#ax.plot(t, theta2_m,'-',linewidth=0.5)
#ax.plot(t, theta2_s,'-',linewidth=0.5)
mylines=ax.plot(t, theta2_w,'o', t, theta2_m, 'o', t,theta2_s,'o')
plt.setp(mylines, markersize=3.0)
matplotlib.rcParams['font.family'] = 'Arial'
# Set common labels
ax.set_xlabel('time [ns]',fontsize=13)
plt.ylabel(r'$\theta_{mic}$ [deg]',fontsize=14)
#ax.set_ylabel(r'R$\ _{BASE} $ [nm]')
#titles for each subplot:
matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
#####ax.set_title(str(c)+' water molec: $\Delta(t)=$'+str(sampling)+'ns')
ax.set_title(str(c)+' water molec.',fontweight='bold',fontsize=15)
matplotlib.rcParams['font.family'] = 'Arial'
i = i+1
matplotlib.rcParams['font.family'] = 'Times New Roman'
mytitle = plt.suptitle(r'Contact Angle $\theta_{mic}$ vs. Time for SAM'+str(b)+'%', fontsize=19, fontweight='bold',x=0.7, y=4.65)
###mytitle = plt.suptitle(r'Contact Angle $\theta_{mic}$ vs. Time for SAM'+str(b)+'%', fontsize=17,x=0.7, y=4.65)
plt.show()
fig.savefig('theta_t_s'+str(b)+'.jpg',bbox_extra_artists=(first_legend,mytitle,), bbox_inches='tight')
# check for better quality:
# plt.savefig('destination_path.eps', format='eps', dpi=1000)
b=11
minblocksize=20 # The minimum block size is 10ns=20 points
beg = 10 # We leave out the first 5ns=10 points
blocksNum=3 #the function best_start uses also 3 blocks for averaging
Nrows = 5
Ncolumns = 2
fig, ax = plt.subplots(Ncolumns, Nrows)
#fig.subplots_adjust(bottom=0.5,top=2.5, left=0.0, right=1.5, hspace = 0.5)
fig.subplots_adjust(bottom=0.0,top=4.5, left=0.0, right=1.5, hspace = 0.35)
matplotlib.rcParams['legend.handlelength'] = 0
matplotlib.rcParams['legend.markerscale'] = 0
matplotlib.rcParams['legend.handletextpad'] = 0
matplotlib.rcParams['legend.markerscale'] = 2
#matplotlib.rcParams['font.family'] = 'Times New Roman'
#matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
errortheta_w[b]=[]
theta_w[b]=[]
start_theta_w[b]=[]
end_theta_w[b]=[]
equil_theta_w[b]=[]
i = 0
for c in Waters:
#for c in [1000]:
n=Waters.index(c)
theta2 = array(angles_w[(b, c)])
end=endpoint(theta2)
start=best_start(theta2,t,beg,minblocksize)
slope, intercept, delete1, delete2, delete3 = stats.linregress(t[start:end],theta2[start:end])
thetamean, errrorbar =blockAverage((theta2[start:end]),blocksNum)
print "for SAM ",b,"% and ", c, " molecules:"
if start == None:
print " Not equilibrated!"
sampling = 0
start = beg
end = endpoint(theta2)
symb='<'
else:
sampling = (end-start)/2.
print "start point=", start, "length of sampling =", sampling, "ns"
print "slope=", slope, "intercept=",intercept
print "average=",thetamean, "error=",errrorbar
symb='>'
ax = plt.subplot(Nrows, Ncolumns, i+1)
m=str(round(abs(slope)*(end-start)/2.,3))
line1, = ax.plot(t[start:end], func(t[start:end], slope, intercept),'r', label='error '+str(round(2*errrorbar,3))+'$^\circ $'+symb+m+'$^\circ $ shift')
ax.plot(t[start:end], theta2[start:end],'-',linewidth=0.5)
#ax.plot(t, theta2,'-',linewidth=0.5)
ax.plot(t[start:end], func(t[start:end], 0, thetamean))
ax.plot(t[start:end], func(t[start:end], 0, thetamean+errrorbar),'g-')
ax.plot(t[start:end], func(t[start:end], 0, thetamean-errrorbar),'g-')
matplotlib.rcParams['font.family'] = 'Arial'
# Set common labels
ax.set_xlabel('time [ns]',fontsize=13)
plt.ylabel(r'$\theta_{mic}$ [deg]',fontsize=14)
#ax.set_ylabel(r'R$\ _{BASE} $ [nm]')
#titles for each subplot:
matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
#####ax.set_title(str(c)+' water molec: $\Delta(t)=$'+str(sampling)+'ns')
ax.set_title(str(c)+' water molec: $\Delta(t)=$'+str(sampling)+'ns',fontweight='bold',fontsize=15)
matplotlib.rcParams['font.family'] = 'Arial'
# Create a legend for the first line.
#first_legend = plt.legend(handles=[line1],bbox_to_anchor=(0.2, 0.9), loc=3,borderaxespad=0.,borderpad=0.2,fontsize=11)
first_legend = plt.legend(loc=1,borderaxespad=0.,borderpad=0.2,fontsize=11)
# Add the legend manually to the current Axes.
ax = plt.gca().add_artist(first_legend)
# SAVING RESULTS
if sampling != 0:
(errortheta_w[b]).append(errrorbar)
(theta_w[b]).append(thetamean)
(start_theta_w[b]).append(start)
(end_theta_w[b]).append(end)
(equil_theta_w[b]).append(c)
i = i+1
matplotlib.rcParams['font.family'] = 'Times New Roman'
mytitle = plt.suptitle(r'Contact Angle $\theta_{mic}$ vs. Time for SAM'+str(b)+'%', fontsize=19, fontweight='bold',x=0.7, y=4.65)
###mytitle = plt.suptitle(r'Contact Angle $\theta_{mic}$ vs. Time for SAM'+str(b)+'%', fontsize=17,x=0.7, y=4.65)
plt.show()
fig.savefig('equil_theta_t_s'+str(b)+'.jpg',bbox_extra_artists=(first_legend,mytitle,), bbox_inches='tight')
# check for better quality:
# plt.savefig('destination_path.eps', format='eps', dpi=1000)
b=11
minblocksize=20 # The minimum block size is 10ns=20 points
beg = 10 # We leave out the first 5ns=10 points
blocksNum=3 #the function best_start uses also 3 blocks for averaging
Nrows = 5
Ncolumns = 2
fig, ax = plt.subplots(Ncolumns, Nrows)
#fig.subplots_adjust(bottom=0.5,top=2.5, left=0.0, right=1.5, hspace = 0.5)
fig.subplots_adjust(bottom=0.0,top=4.5, left=0.0, right=1.5, hspace = 0.35)
matplotlib.rcParams['legend.handlelength'] = 0
matplotlib.rcParams['legend.markerscale'] = 0
matplotlib.rcParams['legend.handletextpad'] = 0
matplotlib.rcParams['legend.markerscale'] = 2
#matplotlib.rcParams['font.family'] = 'Times New Roman'
#matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
errortheta_m[b]=[]
theta_m[b]=[]
start_theta_m[b]=[]
end_theta_m[b]=[]
equil_theta_m[b]=[]
errortheta_s[b]=[]
theta_s[b]=[]
start_theta_s[b]=[]
end_theta_s[b]=[]
equil_theta_s[b]=[]
i = 0
for c in Waters:
#for c in [1000]:
print c," molec:"
n=Waters.index(c)
theta2_w = array(angles_w[(b, c)])
theta2_m = array(angles_m[(b, c)])
theta2_s = array(angles_s[(b, c)])
end=endpoint(theta2_m)
start=best_start(theta2_m,t,beg,minblocksize)
thetamean, errrorbar =blockAverage((theta2_m[start:end]),blocksNum)
# SAVING RESULTS
if start != None:
(errortheta_m[b]).append(errrorbar)
(theta_m[b]).append(thetamean)
(start_theta_m[b]).append(start)
(end_theta_m[b]).append(end)
(equil_theta_m[b]).append(c)
end=endpoint(theta2_s)
start=best_start(theta2_s,t,beg,minblocksize)
thetamean, errrorbar =blockAverage((theta2_s[start:end]),blocksNum)
# SAVING RESULTS
if start != None:
(errortheta_s[b]).append(errrorbar)
(theta_s[b]).append(thetamean)
(start_theta_s[b]).append(start)
(end_theta_s[b]).append(end)
(equil_theta_s[b]).append(c)
ax = plt.subplot(Nrows, Ncolumns, i+1)
####line1, = ax.plot(t, theta2_w,'-',linewidth=0.5)
#ax.plot(t, theta2_w,'-',linewidth=0.5)
#ax.plot(t, theta2_m,'-',linewidth=0.5)
#ax.plot(t, theta2_s,'-',linewidth=0.5)
mylines=ax.plot(t, theta2_w,'o', t, theta2_m, 'o', t,theta2_s,'o')
plt.setp(mylines, markersize=3.0)
matplotlib.rcParams['font.family'] = 'Arial'
# Set common labels
ax.set_xlabel('time [ns]',fontsize=13)
plt.ylabel(r'$\theta_{mic}$ [deg]',fontsize=14)
#ax.set_ylabel(r'R$\ _{BASE} $ [nm]')
#titles for each subplot:
matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
#####ax.set_title(str(c)+' water molec: $\Delta(t)=$'+str(sampling)+'ns')
ax.set_title(str(c)+' water molec.',fontweight='bold',fontsize=15)
matplotlib.rcParams['font.family'] = 'Arial'
i = i+1
matplotlib.rcParams['font.family'] = 'Times New Roman'
mytitle = plt.suptitle(r'Contact Angle $\theta_{mic}$ vs. Time for SAM'+str(b)+'%', fontsize=19, fontweight='bold',x=0.7, y=4.65)
###mytitle = plt.suptitle(r'Contact Angle $\theta_{mic}$ vs. Time for SAM'+str(b)+'%', fontsize=17,x=0.7, y=4.65)
plt.show()
fig.savefig('theta_t_s'+str(b)+'.jpg',bbox_extra_artists=(first_legend,mytitle,), bbox_inches='tight')
# check for better quality:
# plt.savefig('destination_path.eps', format='eps', dpi=1000)
b=17
minblocksize=20 # The minimum block size is 10ns=20 points
beg = 10 # We leave out the first 5ns=10 points
blocksNum=3 #the function best_start uses also 3 blocks for averaging
Nrows = 5
Ncolumns = 2
fig, ax = plt.subplots(Ncolumns, Nrows)
#fig.subplots_adjust(bottom=0.5,top=2.5, left=0.0, right=1.5, hspace = 0.5)
fig.subplots_adjust(bottom=0.0,top=4.5, left=0.0, right=1.5, hspace = 0.35)
matplotlib.rcParams['legend.handlelength'] = 0
matplotlib.rcParams['legend.markerscale'] = 0
matplotlib.rcParams['legend.handletextpad'] = 0
matplotlib.rcParams['legend.markerscale'] = 2
#matplotlib.rcParams['font.family'] = 'Times New Roman'
#matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
errortheta_w[b]=[]
theta_w[b]=[]
start_theta_w[b]=[]
end_theta_w[b]=[]
equil_theta_w[b]=[]
i = 0
for c in Waters:
#for c in [1000]:
n=Waters.index(c)
theta2 = array(angles_w[(b, c)])
end=endpoint(theta2)
start=best_start(theta2,t,beg,minblocksize)
slope, intercept, delete1, delete2, delete3 = stats.linregress(t[start:end],theta2[start:end])
thetamean, errrorbar =blockAverage((theta2[start:end]),blocksNum)
print "for SAM ",b,"% and ", c, " molecules:"
if start == None:
print " Not equilibrated!"
sampling = 0
start = beg
end = endpoint(theta2)
symb='<'
else:
sampling = (end-start)/2.
print "start point=", start, "length of sampling =", sampling, "ns"
print "slope=", slope, "intercept=",intercept
print "average=",thetamean, "error=",errrorbar
symb='>'
ax = plt.subplot(Nrows, Ncolumns, i+1)
m=str(round(abs(slope)*(end-start)/2.,3))
line1, = ax.plot(t[start:end], func(t[start:end], slope, intercept),'r', label='error '+str(round(2*errrorbar,3))+'$^\circ $'+symb+m+'$^\circ $ shift')
ax.plot(t[start:end], theta2[start:end],'-',linewidth=0.5)
#ax.plot(t, theta2,'-',linewidth=0.5)
ax.plot(t[start:end], func(t[start:end], 0, thetamean))
ax.plot(t[start:end], func(t[start:end], 0, thetamean+errrorbar),'g-')
ax.plot(t[start:end], func(t[start:end], 0, thetamean-errrorbar),'g-')
matplotlib.rcParams['font.family'] = 'Arial'
# Set common labels
ax.set_xlabel('time [ns]',fontsize=13)
plt.ylabel(r'$\theta_{mic}$ [deg]',fontsize=14)
#ax.set_ylabel(r'R$\ _{BASE} $ [nm]')
#titles for each subplot:
matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
#####ax.set_title(str(c)+' water molec: $\Delta(t)=$'+str(sampling)+'ns')
ax.set_title(str(c)+' water molec: $\Delta(t)=$'+str(sampling)+'ns',fontweight='bold',fontsize=15)
matplotlib.rcParams['font.family'] = 'Arial'
# Create a legend for the first line.
#first_legend = plt.legend(handles=[line1],bbox_to_anchor=(0.2, 0.9), loc=3,borderaxespad=0.,borderpad=0.2,fontsize=11)
first_legend = plt.legend(loc=1,borderaxespad=0.,borderpad=0.2,fontsize=11)
# Add the legend manually to the current Axes.
ax = plt.gca().add_artist(first_legend)
# SAVING RESULTS
if sampling != 0:
(errortheta_w[b]).append(errrorbar)
(theta_w[b]).append(thetamean)
(start_theta_w[b]).append(start)
(end_theta_w[b]).append(end)
(equil_theta_w[b]).append(c)
i = i+1
matplotlib.rcParams['font.family'] = 'Times New Roman'
mytitle = plt.suptitle(r'Contact Angle $\theta_{mic}$ vs. Time for SAM'+str(b)+'%', fontsize=19, fontweight='bold',x=0.7, y=4.65)
###mytitle = plt.suptitle(r'Contact Angle $\theta_{mic}$ vs. Time for SAM'+str(b)+'%', fontsize=17,x=0.7, y=4.65)
plt.show()
fig.savefig('equil_theta_t_s'+str(b)+'.jpg',bbox_extra_artists=(first_legend,mytitle,), bbox_inches='tight')
# check for better quality:
# plt.savefig('destination_path.eps', format='eps', dpi=1000)
b=17
minblocksize=20 # The minimum block size is 10ns=20 points
beg = 10 # We leave out the first 5ns=10 points
blocksNum=3 #the function best_start uses also 3 blocks for averaging
Nrows = 5
Ncolumns = 2
fig, ax = plt.subplots(Ncolumns, Nrows)
#fig.subplots_adjust(bottom=0.5,top=2.5, left=0.0, right=1.5, hspace = 0.5)
fig.subplots_adjust(bottom=0.0,top=4.5, left=0.0, right=1.5, hspace = 0.35)
matplotlib.rcParams['legend.handlelength'] = 0
matplotlib.rcParams['legend.markerscale'] = 0
matplotlib.rcParams['legend.handletextpad'] = 0
matplotlib.rcParams['legend.markerscale'] = 2
#matplotlib.rcParams['font.family'] = 'Times New Roman'
#matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
errortheta_m[b]=[]
theta_m[b]=[]
start_theta_m[b]=[]
end_theta_m[b]=[]
equil_theta_m[b]=[]
errortheta_s[b]=[]
theta_s[b]=[]
start_theta_s[b]=[]
end_theta_s[b]=[]
equil_theta_s[b]=[]
i = 0
for c in Waters:
#for c in [1000]:
print c," molec:"
n=Waters.index(c)
theta2_w = array(angles_w[(b, c)])
theta2_m = array(angles_m[(b, c)])
theta2_s = array(angles_s[(b, c)])
end=endpoint(theta2_m)
start=best_start(theta2_m,t,beg,minblocksize)
thetamean, errrorbar =blockAverage((theta2_m[start:end]),blocksNum)
# SAVING RESULTS
if start != None:
(errortheta_m[b]).append(errrorbar)
(theta_m[b]).append(thetamean)
(start_theta_m[b]).append(start)
(end_theta_m[b]).append(end)
(equil_theta_m[b]).append(c)
end=endpoint(theta2_s)
start=best_start(theta2_s,t,beg,minblocksize)
thetamean, errrorbar =blockAverage((theta2_s[start:end]),blocksNum)
# SAVING RESULTS
if start != None:
(errortheta_s[b]).append(errrorbar)
(theta_s[b]).append(thetamean)
(start_theta_s[b]).append(start)
(end_theta_s[b]).append(end)
(equil_theta_s[b]).append(c)
ax = plt.subplot(Nrows, Ncolumns, i+1)
####line1, = ax.plot(t, theta2_w,'-',linewidth=0.5)
#ax.plot(t, theta2_w,'-',linewidth=0.5)
#ax.plot(t, theta2_m,'-',linewidth=0.5)
#ax.plot(t, theta2_s,'-',linewidth=0.5)
mylines=ax.plot(t, theta2_w,'o', t, theta2_m, 'o', t,theta2_s,'o')
plt.setp(mylines, markersize=3.0)
matplotlib.rcParams['font.family'] = 'Arial'
# Set common labels
ax.set_xlabel('time [ns]',fontsize=13)
plt.ylabel(r'$\theta_{mic}$ [deg]',fontsize=14)
#ax.set_ylabel(r'R$\ _{BASE} $ [nm]')
#titles for each subplot:
matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
#####ax.set_title(str(c)+' water molec: $\Delta(t)=$'+str(sampling)+'ns')
ax.set_title(str(c)+' water molec.',fontweight='bold',fontsize=15)
matplotlib.rcParams['font.family'] = 'Arial'
i = i+1
matplotlib.rcParams['font.family'] = 'Times New Roman'
mytitle = plt.suptitle(r'Contact Angle $\theta_{mic}$ vs. Time for SAM'+str(b)+'%', fontsize=19, fontweight='bold',x=0.7, y=4.65)
###mytitle = plt.suptitle(r'Contact Angle $\theta_{mic}$ vs. Time for SAM'+str(b)+'%', fontsize=17,x=0.7, y=4.65)
plt.show()
fig.savefig('theta_t_s'+str(b)+'.jpg',bbox_extra_artists=(first_legend,mytitle,), bbox_inches='tight')
# check for better quality:
# plt.savefig('destination_path.eps', format='eps', dpi=1000)
b=33
minblocksize=20 # The minimum block size is 10ns=20 points
beg = 10 # We leave out the first 5ns=10 points
blocksNum=3 #the function best_start uses also 3 blocks for averaging
Nrows = 5
Ncolumns = 2
fig, ax = plt.subplots(Ncolumns, Nrows)
#fig.subplots_adjust(bottom=0.5,top=2.5, left=0.0, right=1.5, hspace = 0.5)
fig.subplots_adjust(bottom=0.0,top=4.5, left=0.0, right=1.5, hspace = 0.35)
matplotlib.rcParams['legend.handlelength'] = 0
matplotlib.rcParams['legend.markerscale'] = 0
matplotlib.rcParams['legend.handletextpad'] = 0
matplotlib.rcParams['legend.markerscale'] = 2
#matplotlib.rcParams['font.family'] = 'Times New Roman'
#matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
errortheta_w[b]=[]
theta_w[b]=[]
start_theta_w[b]=[]
end_theta_w[b]=[]
equil_theta_w[b]=[]
i = 0
for c in Waters:
#for c in [1000]:
n=Waters.index(c)
theta2 = array(angles_w[(b, c)])
end=endpoint(theta2)
start=best_start(theta2,t,beg,minblocksize)
slope, intercept, delete1, delete2, delete3 = stats.linregress(t[start:end],theta2[start:end])
thetamean, errrorbar =blockAverage((theta2[start:end]),blocksNum)
print "for SAM ",b,"% and ", c, " molecules:"
if start == None:
print " Not equilibrated!"
sampling = 0
start = beg
end = endpoint(theta2)
symb='<'
else:
sampling = (end-start)/2.
print "start point=", start, "length of sampling =", sampling, "ns"
print "slope=", slope, "intercept=",intercept
print "average=",thetamean, "error=",errrorbar
symb='>'
ax = plt.subplot(Nrows, Ncolumns, i+1)
m=str(round(abs(slope)*(end-start)/2.,3))
line1, = ax.plot(t[start:end], func(t[start:end], slope, intercept),'r', label='error '+str(round(2*errrorbar,3))+'$^\circ $'+symb+m+'$^\circ $ shift')
ax.plot(t[start:end], theta2[start:end],'-',linewidth=0.5)
#ax.plot(t, theta2,'-',linewidth=0.5)
ax.plot(t[start:end], func(t[start:end], 0, thetamean))
ax.plot(t[start:end], func(t[start:end], 0, thetamean+errrorbar),'g-')
ax.plot(t[start:end], func(t[start:end], 0, thetamean-errrorbar),'g-')
matplotlib.rcParams['font.family'] = 'Arial'
# Set common labels
ax.set_xlabel('time [ns]',fontsize=13)
plt.ylabel(r'$\theta_{mic}$ [deg]',fontsize=14)
#ax.set_ylabel(r'R$\ _{BASE} $ [nm]')
#titles for each subplot:
matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
#####ax.set_title(str(c)+' water molec: $\Delta(t)=$'+str(sampling)+'ns')
ax.set_title(str(c)+' water molec: $\Delta(t)=$'+str(sampling)+'ns',fontweight='bold',fontsize=15)
matplotlib.rcParams['font.family'] = 'Arial'
# Create a legend for the first line.
#first_legend = plt.legend(handles=[line1],bbox_to_anchor=(0.2, 0.9), loc=3,borderaxespad=0.,borderpad=0.2,fontsize=11)
first_legend = plt.legend(loc=1,borderaxespad=0.,borderpad=0.2,fontsize=11)
# Add the legend manually to the current Axes.
ax = plt.gca().add_artist(first_legend)
# SAVING RESULTS
if sampling != 0:
(errortheta_w[b]).append(errrorbar)
(theta_w[b]).append(thetamean)
(start_theta_w[b]).append(start)
(end_theta_w[b]).append(end)
(equil_theta_w[b]).append(c)
i = i+1
matplotlib.rcParams['font.family'] = 'Times New Roman'
mytitle = plt.suptitle(r'Contact Angle $\theta_{mic}$ vs. Time for SAM'+str(b)+'%', fontsize=19, fontweight='bold',x=0.7, y=4.65)
###mytitle = plt.suptitle(r'Contact Angle $\theta_{mic}$ vs. Time for SAM'+str(b)+'%', fontsize=17,x=0.7, y=4.65)
plt.show()
fig.savefig('equil_theta_t_s'+str(b)+'.jpg',bbox_extra_artists=(first_legend,mytitle,), bbox_inches='tight')
# check for better quality:
# plt.savefig('destination_path.eps', format='eps', dpi=1000)
b=33
minblocksize=20 # The minimum block size is 10ns=20 points
beg = 10 # We leave out the first 5ns=10 points
blocksNum=3 #the function best_start uses also 3 blocks for averaging
Nrows = 5
Ncolumns = 2
fig, ax = plt.subplots(Ncolumns, Nrows)
#fig.subplots_adjust(bottom=0.5,top=2.5, left=0.0, right=1.5, hspace = 0.5)
fig.subplots_adjust(bottom=0.0,top=4.5, left=0.0, right=1.5, hspace = 0.35)
matplotlib.rcParams['legend.handlelength'] = 0
matplotlib.rcParams['legend.markerscale'] = 0
matplotlib.rcParams['legend.handletextpad'] = 0
matplotlib.rcParams['legend.markerscale'] = 2
#matplotlib.rcParams['font.family'] = 'Times New Roman'
#matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
errortheta_m[b]=[]
theta_m[b]=[]
start_theta_m[b]=[]
end_theta_m[b]=[]
equil_theta_m[b]=[]
errortheta_s[b]=[]
theta_s[b]=[]
start_theta_s[b]=[]
end_theta_s[b]=[]
equil_theta_s[b]=[]
i = 0
for c in Waters:
#for c in [1000]:
print c," molec:"
n=Waters.index(c)
theta2_w = array(angles_w[(b, c)])
theta2_m = array(angles_m[(b, c)])
theta2_s = array(angles_s[(b, c)])
end=endpoint(theta2_m)
start=best_start(theta2_m,t,beg,minblocksize)
thetamean, errrorbar =blockAverage((theta2_m[start:end]),blocksNum)
# SAVING RESULTS
if start != None:
(errortheta_m[b]).append(errrorbar)
(theta_m[b]).append(thetamean)
(start_theta_m[b]).append(start)
(end_theta_m[b]).append(end)
(equil_theta_m[b]).append(c)
end=endpoint(theta2_s)
start=best_start(theta2_s,t,beg,minblocksize)
thetamean, errrorbar =blockAverage((theta2_s[start:end]),blocksNum)
# SAVING RESULTS
if start != None:
(errortheta_s[b]).append(errrorbar)
(theta_s[b]).append(thetamean)
(start_theta_s[b]).append(start)
(end_theta_s[b]).append(end)
(equil_theta_s[b]).append(c)
ax = plt.subplot(Nrows, Ncolumns, i+1)
####line1, = ax.plot(t, theta2_w,'-',linewidth=0.5)
#ax.plot(t, theta2_w,'-',linewidth=0.5)
#ax.plot(t, theta2_m,'-',linewidth=0.5)
#ax.plot(t, theta2_s,'-',linewidth=0.5)
#print theta2_m
#print theta2_s
mylines=ax.plot(t, theta2_w,'o', t, theta2_m, 'o', t,theta2_s,'o')
plt.setp(mylines, markersize=3.0)
matplotlib.rcParams['font.family'] = 'Arial'
# Set common labels
ax.set_xlabel('time [ns]',fontsize=13)
plt.ylabel(r'$\theta_{mic}$ [deg]',fontsize=14)
#ax.set_ylabel(r'R$\ _{BASE} $ [nm]')
#titles for each subplot:
matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
#####ax.set_title(str(c)+' water molec: $\Delta(t)=$'+str(sampling)+'ns')
ax.set_title(str(c)+' water molec.',fontweight='bold',fontsize=15)
matplotlib.rcParams['font.family'] = 'Arial'
i = i+1
matplotlib.rcParams['font.family'] = 'Times New Roman'
mytitle = plt.suptitle(r'Contact Angle $\theta_{mic}$ vs. Time for SAM'+str(b)+'%', fontsize=19, fontweight='bold',x=0.7, y=4.65)
###mytitle = plt.suptitle(r'Contact Angle $\theta_{mic}$ vs. Time for SAM'+str(b)+'%', fontsize=17,x=0.7, y=4.65)
plt.show()
fig.savefig('theta_t_s'+str(b)+'.jpg',bbox_extra_artists=(first_legend,mytitle,), bbox_inches='tight')
# check for better quality:
# plt.savefig('destination_path.eps', format='eps', dpi=1000)
################################ r_base #################################
b=0
minblocksize=20 # The minimum block size is 10ns=20 points
beg = 10 # We leave out the first 5ns=10 points
blocksNum=3 #the function best_start uses also 3 blocks for averaging
Nrows = 5
Ncolumns = 2
fig, ax = plt.subplots(Ncolumns, Nrows)
#fig.subplots_adjust(bottom=0.5,top=2.5, left=0.0, right=1.5, hspace = 0.5)
fig.subplots_adjust(bottom=0.0,top=4.5, left=0.0, right=1.5, hspace = 0.35)
matplotlib.rcParams['legend.handlelength'] = 0
matplotlib.rcParams['legend.markerscale'] = 0
matplotlib.rcParams['legend.handletextpad'] = 0
matplotlib.rcParams['legend.markerscale'] = 2
#matplotlib.rcParams['font.family'] = 'Times New Roman'
#matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
error_rbase_w[b]=[]
rbase_w[b]=[]
start_rbase_w[b]=[]
end_rbase_w[b]=[]
equil_rbase_w[b]=[]
i = 0
for c in Waters:
#for c in [1000]:
n=Waters.index(c)
rbase2 = array(radii_w[(b, c)])
end=endpoint(rbase2)
start=best_start(rbase2,t,beg,minblocksize)
slope, intercept, delete1, delete2, delete3 = stats.linregress(t[start:end],rbase2[start:end])
rbasemean, errrorbar =blockAverage((rbase2[start:end]),blocksNum)
print "for SAM ",b,"% and ", c, " molecules:"
if start == None:
print " Not equilibrated!"
sampling = 0
start = beg
end = endpoint(rbase2)
symb='<'
else:
sampling = (end-start)/2.
print "start point=", start, "length of sampling =", sampling, "ns"
print "slope=", slope, "intercept=",intercept
print "average=",rbasemean, "error=",errrorbar
symb='>'
ax = plt.subplot(Nrows, Ncolumns, i+1)
m=str(round(abs(slope)*(end-start)/2.,3))
line1, = ax.plot(t[start:end], func(t[start:end], slope, intercept),'r', label='error '+str(round(2*errrorbar,3))+'$^\circ $'+symb+m+'$^\circ $ shift')
ax.plot(t[start:end], rbase2[start:end],'-',linewidth=0.5)
ax.plot(t[start:end], func(t[start:end], 0, rbasemean))
ax.plot(t[start:end], func(t[start:end], 0, rbasemean+errrorbar),'g-')
ax.plot(t[start:end], func(t[start:end], 0, rbasemean-errrorbar),'g-')
matplotlib.rcParams['font.family'] = 'Arial'
# Set common labels
ax.set_xlabel('time [ns]',fontsize=13)
#plt.ylabel(r'$\theta_{mic}$ [deg]')
ax.set_ylabel(r'R$\ _{BASE} $ [nm]',fontsize=14)
#titles for each subplot:
matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
#####ax.set_title(str(c)+' water molec: $\Delta(t)=$'+str(sampling)+'ns')
ax.set_title(str(c)+' water molec: $\Delta(t)=$'+str(sampling)+'ns',fontweight='bold',fontsize=15)
matplotlib.rcParams['font.family'] = 'Arial'
# Create a legend for the first line.
#first_legend = plt.legend(handles=[line1],bbox_to_anchor=(0.2, 0.9), loc=3,borderaxespad=0.,borderpad=0.2,fontsize=11)
first_legend = plt.legend(loc=1,borderaxespad=0.,borderpad=0.2,fontsize=11)
# Add the legend manually to the current Axes.
ax = plt.gca().add_artist(first_legend)
# SAVING RESULTS
if sampling != 0:
(error_rbase_w[b]).append(errrorbar)
(rbase_w[b]).append(rbasemean)
(start_rbase_w[b]).append(start)
(end_rbase_w[b]).append(end)
(equil_rbase_w[b]).append(c)
i = i+1
matplotlib.rcParams['font.family'] = 'Times New Roman'
mytitle = plt.suptitle(r'Base Radius $R_{base}$ vs. Time for SAM'+str(b)+'%', fontsize=19, fontweight='bold',x=0.7, y=4.65)
###mytitle = plt.suptitle(r'Contact Angle $\theta_{mic}$ vs. Time for SAM'+str(b)+'%', fontsize=17,x=0.7, y=4.65)
plt.show()
fig.savefig('equil_Rbase_t_s'+str(b)+'.jpg',bbox_extra_artists=(first_legend,mytitle,), bbox_inches='tight')
# check for better quality:
# plt.savefig('destination_path.eps', format='eps', dpi=1000)
b=0
minblocksize=20 # The minimum block size is 10ns=20 points
beg = 10 # We leave out the first 5ns=10 points
blocksNum=3 #the function best_start uses also 3 blocks for averaging
Nrows = 5
Ncolumns = 2
fig, ax = plt.subplots(Ncolumns, Nrows)
#fig.subplots_adjust(bottom=0.5,top=2.5, left=0.0, right=1.5, hspace = 0.5)
fig.subplots_adjust(bottom=0.0,top=4.5, left=0.0, right=1.5, hspace = 0.35)
matplotlib.rcParams['legend.handlelength'] = 0
matplotlib.rcParams['legend.markerscale'] = 0
matplotlib.rcParams['legend.handletextpad'] = 0
matplotlib.rcParams['legend.markerscale'] = 2
#matplotlib.rcParams['font.family'] = 'Times New Roman'
#matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
error_rbase_m[b]=[]
rbase_m[b]=[]
start_rbase_m[b]=[]
end_rbase_m[b]=[]
equil_rbase_m[b]=[]
error_rbase_s[b]=[]
rbase_s[b]=[]
start_rbase_s[b]=[]
end_rbase_s[b]=[]
equil_rbase_s[b]=[]
i = 0
for c in Waters:
#for c in [1000]:
n=Waters.index(c)
rbase2_w = array(radii_w[(b, c)])
rbase2_m = array(radii_m[(b, c)])
rbase2_s = array(radii_s[(b, c)])
end=endpoint(rbase2_m)
start=best_start(rbase2_m,t,beg,minblocksize)
rbasemean, errrorbar =blockAverage((rbase2_m[start:end]),blocksNum)
# SAVING RESULTS
if start != None:
(error_rbase_m[b]).append(errrorbar)
(rbase_m[b]).append(rbasemean)
(start_rbase_m[b]).append(start)
(end_rbase_m[b]).append(end)
(equil_rbase_m[b]).append(c)
end=endpoint(rbase2_s)
start=best_start(rbase2_s,t,beg,minblocksize)
rbasemean, errrorbar =blockAverage((rbase2_s[start:end]),blocksNum)
# SAVING RESULTS
if start != None:
(error_rbase_s[b]).append(errrorbar)
(rbase_s[b]).append(rbasemean)
(start_rbase_s[b]).append(start)
(end_rbase_s[b]).append(end)
(equil_rbase_s[b]).append(c)
ax = plt.subplot(Nrows, Ncolumns, i+1)
####line1, = ax.plot(t, rbase2_w,'-',linewidth=0.5)
#ax.plot(t, rbase2_w,'-',linewidth=0.5)
#ax.plot(t, rbase2_m,'-',linewidth=0.5)
#ax.plot(t, rbase2_s,'-',linewidth=0.5)
mylines=ax.plot(t, rbase2_w,'o', t, rbase2_m, 'o', t,rbase2_s,'o')
plt.setp(mylines, markersize=3.0)
matplotlib.rcParams['font.family'] = 'Arial'
# Set common labels
ax.set_xlabel('time [ns]',fontsize=13)
ax.set_ylabel(r'R$\ _{BASE} $ [nm]',fontsize=14)
#titles for each subplot:
matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
ax.set_title(str(c)+' water molec.',fontweight='bold',fontsize=15)
matplotlib.rcParams['font.family'] = 'Arial'
i = i+1
matplotlib.rcParams['font.family'] = 'Times New Roman'
mytitle = plt.suptitle(r'Base Radius $R_{base}$ vs. Time for SAM'+str(b)+'%', fontsize=19, fontweight='bold',x=0.7, y=4.65)
plt.show()
fig.savefig('rbase_t_s'+str(b)+'.jpg',bbox_extra_artists=(first_legend,mytitle,), bbox_inches='tight')
# check for better quality:
# plt.savefig('destination_path.eps', format='eps', dpi=1000)
################################ r_base #################################
b=5
minblocksize=20 # The minimum block size is 10ns=20 points
beg = 10 # We leave out the first 5ns=10 points
blocksNum=3 #the function best_start uses also 3 blocks for averaging
Nrows = 5
Ncolumns = 2
fig, ax = plt.subplots(Ncolumns, Nrows)
#fig.subplots_adjust(bottom=0.5,top=2.5, left=0.0, right=1.5, hspace = 0.5)
fig.subplots_adjust(bottom=0.0,top=4.5, left=0.0, right=1.5, hspace = 0.35)
matplotlib.rcParams['legend.handlelength'] = 0
matplotlib.rcParams['legend.markerscale'] = 0
matplotlib.rcParams['legend.handletextpad'] = 0
matplotlib.rcParams['legend.markerscale'] = 2
#matplotlib.rcParams['font.family'] = 'Times New Roman'
#matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
error_rbase_w[b]=[]
rbase_w[b]=[]
start_rbase_w[b]=[]
end_rbase_w[b]=[]
equil_rbase_w[b]=[]
i = 0
for c in Waters:
#for c in [1000]:
n=Waters.index(c)
rbase2 = array(radii_w[(b, c)])
end=endpoint(rbase2)
start=best_start(rbase2,t,beg,minblocksize)
slope, intercept, delete1, delete2, delete3 = stats.linregress(t[start:end],rbase2[start:end])
rbasemean, errrorbar =blockAverage((rbase2[start:end]),blocksNum)
print "for SAM ",b,"% and ", c, " molecules:"
if start == None:
print " Not equilibrated!"
sampling = 0
start = beg
end = endpoint(rbase2)
symb='<'
else:
sampling = (end-start)/2.
print "start point=", start, "length of sampling =", sampling, "ns"
print "slope=", slope, "intercept=",intercept
print "average=",rbasemean, "error=",errrorbar
symb='>'
ax = plt.subplot(Nrows, Ncolumns, i+1)
m=str(round(abs(slope)*(end-start)/2.,3))
line1, = ax.plot(t[start:end], func(t[start:end], slope, intercept),'r', label='error '+str(round(2*errrorbar,3))+'$^\circ $'+symb+m+'$^\circ $ shift')
ax.plot(t[start:end], rbase2[start:end],'-',linewidth=0.5)
ax.plot(t[start:end], func(t[start:end], 0, rbasemean))
ax.plot(t[start:end], func(t[start:end], 0, rbasemean+errrorbar),'g-')
ax.plot(t[start:end], func(t[start:end], 0, rbasemean-errrorbar),'g-')
matplotlib.rcParams['font.family'] = 'Arial'
# Set common labels
ax.set_xlabel('time [ns]',fontsize=13)
#plt.ylabel(r'$\theta_{mic}$ [deg]')
ax.set_ylabel(r'R$\ _{BASE} $ [nm]',fontsize=14)
#titles for each subplot:
matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
#####ax.set_title(str(c)+' water molec: $\Delta(t)=$'+str(sampling)+'ns')
ax.set_title(str(c)+' water molec: $\Delta(t)=$'+str(sampling)+'ns',fontweight='bold',fontsize=15)
matplotlib.rcParams['font.family'] = 'Arial'
# Create a legend for the first line.
#first_legend = plt.legend(handles=[line1],bbox_to_anchor=(0.2, 0.9), loc=3,borderaxespad=0.,borderpad=0.2,fontsize=11)
first_legend = plt.legend(loc=1,borderaxespad=0.,borderpad=0.2,fontsize=11)
# Add the legend manually to the current Axes.
ax = plt.gca().add_artist(first_legend)
# SAVING RESULTS
if sampling != 0:
(error_rbase_w[b]).append(errrorbar)
(rbase_w[b]).append(rbasemean)
(start_rbase_w[b]).append(start)
(end_rbase_w[b]).append(end)
(equil_rbase_w[b]).append(c)
i = i+1
matplotlib.rcParams['font.family'] = 'Times New Roman'
mytitle = plt.suptitle(r'Base Radius $R_{base}$ vs. Time for SAM'+str(b)+'%', fontsize=19, fontweight='bold',x=0.7, y=4.65)
###mytitle = plt.suptitle(r'Contact Angle $\theta_{mic}$ vs. Time for SAM'+str(b)+'%', fontsize=17,x=0.7, y=4.65)
plt.show()
fig.savefig('equil_Rbase_t_s'+str(b)+'.jpg',bbox_extra_artists=(first_legend,mytitle,), bbox_inches='tight')
# check for better quality:
# plt.savefig('destination_path.eps', format='eps', dpi=1000)
b=5
minblocksize=20 # The minimum block size is 10ns=20 points
beg = 10 # We leave out the first 5ns=10 points
blocksNum=3 #the function best_start uses also 3 blocks for averaging
Nrows = 5
Ncolumns = 2
fig, ax = plt.subplots(Ncolumns, Nrows)
#fig.subplots_adjust(bottom=0.5,top=2.5, left=0.0, right=1.5, hspace = 0.5)
fig.subplots_adjust(bottom=0.0,top=4.5, left=0.0, right=1.5, hspace = 0.35)
matplotlib.rcParams['legend.handlelength'] = 0
matplotlib.rcParams['legend.markerscale'] = 0
matplotlib.rcParams['legend.handletextpad'] = 0
matplotlib.rcParams['legend.markerscale'] = 2
#matplotlib.rcParams['font.family'] = 'Times New Roman'
#matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
error_rbase_m[b]=[]
rbase_m[b]=[]
start_rbase_m[b]=[]
end_rbase_m[b]=[]
equil_rbase_m[b]=[]
error_rbase_s[b]=[]
rbase_s[b]=[]
start_rbase_s[b]=[]
end_rbase_s[b]=[]
equil_rbase_s[b]=[]
i = 0
for c in Waters:
#for c in [1000]:
n=Waters.index(c)
rbase2_w = array(radii_w[(b, c)])
rbase2_m = array(radii_m[(b, c)])
rbase2_s = array(radii_s[(b, c)])
end=endpoint(rbase2_m)
start=best_start(rbase2_m,t,beg,minblocksize)
rbasemean, errrorbar =blockAverage((rbase2_m[start:end]),blocksNum)
# SAVING RESULTS
if start != None:
(error_rbase_m[b]).append(errrorbar)
(rbase_m[b]).append(rbasemean)
(start_rbase_m[b]).append(start)
(end_rbase_m[b]).append(end)
(equil_rbase_m[b]).append(c)
end=endpoint(rbase2_s)
start=best_start(rbase2_s,t,beg,minblocksize)
rbasemean, errrorbar =blockAverage((rbase2_s[start:end]),blocksNum)
# SAVING RESULTS
if start != None:
(error_rbase_s[b]).append(errrorbar)
(rbase_s[b]).append(rbasemean)
(start_rbase_s[b]).append(start)
(end_rbase_s[b]).append(end)
(equil_rbase_s[b]).append(c)
ax = plt.subplot(Nrows, Ncolumns, i+1)
####line1, = ax.plot(t, rbase2_w,'-',linewidth=0.5)
#ax.plot(t, rbase2_w,'-',linewidth=0.5)
#ax.plot(t, rbase2_m,'-',linewidth=0.5)
#ax.plot(t, rbase2_s,'-',linewidth=0.5)
mylines=ax.plot(t, rbase2_w,'o', t, rbase2_m, 'o', t,rbase2_s,'o')
plt.setp(mylines, markersize=3.0)
matplotlib.rcParams['font.family'] = 'Arial'
# Set common labels
ax.set_xlabel('time [ns]',fontsize=13)
ax.set_ylabel(r'R$\ _{BASE} $ [nm]',fontsize=14)
#titles for each subplot:
matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
ax.set_title(str(c)+' water molec.',fontweight='bold',fontsize=15)
matplotlib.rcParams['font.family'] = 'Arial'
i = i+1
matplotlib.rcParams['font.family'] = 'Times New Roman'
mytitle = plt.suptitle(r'Base Radius $R_{base}$ vs. Time for SAM'+str(b)+'%', fontsize=19, fontweight='bold',x=0.7, y=4.65)
plt.show()
fig.savefig('rbase_t_s'+str(b)+'.jpg',bbox_extra_artists=(first_legend,mytitle,), bbox_inches='tight')
# check for better quality:
# plt.savefig('destination_path.eps', format='eps', dpi=1000)
################################ r_base #################################
b=11
minblocksize=20 # The minimum block size is 10ns=20 points
beg = 10 # We leave out the first 5ns=10 points
blocksNum=3 #the function best_start uses also 3 blocks for averaging
Nrows = 5
Ncolumns = 2
fig, ax = plt.subplots(Ncolumns, Nrows)
#fig.subplots_adjust(bottom=0.5,top=2.5, left=0.0, right=1.5, hspace = 0.5)
fig.subplots_adjust(bottom=0.0,top=4.5, left=0.0, right=1.5, hspace = 0.35)
matplotlib.rcParams['legend.handlelength'] = 0
matplotlib.rcParams['legend.markerscale'] = 0
matplotlib.rcParams['legend.handletextpad'] = 0
matplotlib.rcParams['legend.markerscale'] = 2
#matplotlib.rcParams['font.family'] = 'Times New Roman'
#matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
error_rbase_w[b]=[]
rbase_w[b]=[]
start_rbase_w[b]=[]
end_rbase_w[b]=[]
equil_rbase_w[b]=[]
error_rbase_m[b]=[]
rbase_m[b]=[]
start_rbase_m[b]=[]
end_rbase_m[b]=[]
equil_rbase_m[b]=[]
error_rbase_s[b]=[]
rbase_s[b]=[]
start_rbase_s[b]=[]
end_rbase_s[b]=[]
equil_rbase_s[b]=[]
i = 0
for c in Waters:
#for c in [1000]:
n=Waters.index(c)
rbase2 = array(radii_w[(b, c)])
end=endpoint(rbase2)
start=best_start(rbase2,t,beg,minblocksize)
slope, intercept, delete1, delete2, delete3 = stats.linregress(t[start:end],rbase2[start:end])
rbasemean, errrorbar =blockAverage((rbase2[start:end]),blocksNum)
print "for SAM ",b,"% and ", c, " molecules:"
if start == None:
print " Not equilibrated!"
sampling = 0
start = beg
end = endpoint(rbase2)
symb='<'
else:
sampling = (end-start)/2.
print "start point=", start, "length of sampling =", sampling, "ns"
print "slope=", slope, "intercept=",intercept
print "average=",rbasemean, "error=",errrorbar
symb='>'
ax = plt.subplot(Nrows, Ncolumns, i+1)
m=str(round(abs(slope)*(end-start)/2.,3))
line1, = ax.plot(t[start:end], func(t[start:end], slope, intercept),'r', label='error '+str(round(2*errrorbar,3))+'$^\circ $'+symb+m+'$^\circ $ shift')
ax.plot(t[start:end], rbase2[start:end],'-',linewidth=0.5)
ax.plot(t[start:end], func(t[start:end], 0, rbasemean))
ax.plot(t[start:end], func(t[start:end], 0, rbasemean+errrorbar),'g-')
ax.plot(t[start:end], func(t[start:end], 0, rbasemean-errrorbar),'g-')
matplotlib.rcParams['font.family'] = 'Arial'
# Set common labels
ax.set_xlabel('time [ns]',fontsize=13)
#plt.ylabel(r'$\theta_{mic}$ [deg]')
ax.set_ylabel(r'R$\ _{BASE} $ [nm]',fontsize=14)
#titles for each subplot:
matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
#####ax.set_title(str(c)+' water molec: $\Delta(t)=$'+str(sampling)+'ns')
ax.set_title(str(c)+' water molec: $\Delta(t)=$'+str(sampling)+'ns',fontweight='bold',fontsize=15)
matplotlib.rcParams['font.family'] = 'Arial'
# Create a legend for the first line.
#first_legend = plt.legend(handles=[line1],bbox_to_anchor=(0.2, 0.9), loc=3,borderaxespad=0.,borderpad=0.2,fontsize=11)
first_legend = plt.legend(loc=1,borderaxespad=0.,borderpad=0.2,fontsize=11)
# Add the legend manually to the current Axes.
ax = plt.gca().add_artist(first_legend)
# SAVING RESULTS
if sampling != 0:
(error_rbase_w[b]).append(errrorbar)
(rbase_w[b]).append(rbasemean)
(start_rbase_w[b]).append(start)
(end_rbase_w[b]).append(end)
(equil_rbase_w[b]).append(c)
i = i+1
matplotlib.rcParams['font.family'] = 'Times New Roman'
mytitle = plt.suptitle(r'Base Radius $R_{base}$ vs. Time for SAM'+str(b)+'%', fontsize=19, fontweight='bold',x=0.7, y=4.65)
###mytitle = plt.suptitle(r'Contact Angle $\theta_{mic}$ vs. Time for SAM'+str(b)+'%', fontsize=17,x=0.7, y=4.65)
plt.show()
fig.savefig('equil_Rbase_t_s'+str(b)+'.jpg',bbox_extra_artists=(first_legend,mytitle,), bbox_inches='tight')
# check for better quality:
# plt.savefig('destination_path.eps', format='eps', dpi=1000)
b=11
minblocksize=20 # The minimum block size is 10ns=20 points
beg = 10 # We leave out the first 5ns=10 points
blocksNum=3 #the function best_start uses also 3 blocks for averaging
Nrows = 5
Ncolumns = 2
fig, ax = plt.subplots(Ncolumns, Nrows)
#fig.subplots_adjust(bottom=0.5,top=2.5, left=0.0, right=1.5, hspace = 0.5)
fig.subplots_adjust(bottom=0.0,top=4.5, left=0.0, right=1.5, hspace = 0.35)
matplotlib.rcParams['legend.handlelength'] = 0
matplotlib.rcParams['legend.markerscale'] = 0
matplotlib.rcParams['legend.handletextpad'] = 0
matplotlib.rcParams['legend.markerscale'] = 2
#matplotlib.rcParams['font.family'] = 'Times New Roman'
#matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
error_rbase_m[b]=[]
rbase_m[b]=[]
start_rbase_m[b]=[]
end_rbase_m[b]=[]
equil_rbase_m[b]=[]
error_rbase_s[b]=[]
rbase_s[b]=[]
start_rbase_s[b]=[]
end_rbase_s[b]=[]
equil_rbase_s[b]=[]
i = 0
for c in Waters:
#for c in [1000]:
n=Waters.index(c)
rbase2_w = array(radii_w[(b, c)])
rbase2_m = array(radii_m[(b, c)])
rbase2_s = array(radii_s[(b, c)])
print 'TEST',rbase2_m[5], rbase2_s[5]
end=endpoint(rbase2_m)
start=best_start(rbase2_m,t,beg,minblocksize)
rbasemean, errrorbar =blockAverage((rbase2_m[start:end]),blocksNum)
# SAVING RESULTS
if start != None:
(error_rbase_m[b]).append(errrorbar)
(rbase_m[b]).append(rbasemean)
(start_rbase_m[b]).append(start)
(end_rbase_m[b]).append(end)
(equil_rbase_m[b]).append(c)
end=endpoint(rbase2_s)
start=best_start(rbase2_s,t,beg,minblocksize)
rbasemean, errrorbar =blockAverage((rbase2_s[start:end]),blocksNum)
# SAVING RESULTS
if start != None:
(error_rbase_s[b]).append(errrorbar)
(rbase_s[b]).append(rbasemean)
(start_rbase_s[b]).append(start)
(end_rbase_s[b]).append(end)
(equil_rbase_s[b]).append(c)
ax = plt.subplot(Nrows, Ncolumns, i+1)
####line1, = ax.plot(t, rbase2_w,'-',linewidth=0.5)
#ax.plot(t, rbase2_w,'-',linewidth=0.5)
#ax.plot(t, rbase2_m,'-',linewidth=0.5)
#ax.plot(t, rbase2_s,'-',linewidth=0.5)
mylines=ax.plot(t, rbase2_w,'o', t, rbase2_m, 'o', t,rbase2_s,'o')
plt.setp(mylines, markersize=3.0)
matplotlib.rcParams['font.family'] = 'Arial'
# Set common labels
ax.set_xlabel('time [ns]',fontsize=13)
ax.set_ylabel(r'R$\ _{BASE} $ [nm]',fontsize=14)
#titles for each subplot:
matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
ax.set_title(str(c)+' water molec.',fontweight='bold',fontsize=15)
matplotlib.rcParams['font.family'] = 'Arial'
i = i+1
matplotlib.rcParams['font.family'] = 'Times New Roman'
mytitle = plt.suptitle(r'Base Radius $R_{base}$ vs. Time for SAM'+str(b)+'%', fontsize=19, fontweight='bold',x=0.7, y=4.65)
plt.show()
fig.savefig('rbase_t_s'+str(b)+'.jpg',bbox_extra_artists=(first_legend,mytitle,), bbox_inches='tight')
# check for better quality:
# plt.savefig('destination_path.eps', format='eps', dpi=1000)
################################ r_base #################################
b=17
minblocksize=20 # The minimum block size is 10ns=20 points
beg = 10 # We leave out the first 5ns=10 points
blocksNum=3 #the function best_start uses also 3 blocks for averaging
Nrows = 5
Ncolumns = 2
fig, ax = plt.subplots(Ncolumns, Nrows)
#fig.subplots_adjust(bottom=0.5,top=2.5, left=0.0, right=1.5, hspace = 0.5)
fig.subplots_adjust(bottom=0.0,top=4.5, left=0.0, right=1.5, hspace = 0.35)
matplotlib.rcParams['legend.handlelength'] = 0
matplotlib.rcParams['legend.markerscale'] = 0
matplotlib.rcParams['legend.handletextpad'] = 0
matplotlib.rcParams['legend.markerscale'] = 2
#matplotlib.rcParams['font.family'] = 'Times New Roman'
#matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
error_rbase_w[b]=[]
rbase_w[b]=[]
start_rbase_w[b]=[]
end_rbase_w[b]=[]
equil_rbase_w[b]=[]
i = 0
for c in Waters:
#for c in [1000]:
n=Waters.index(c)
rbase2 = array(radii_w[(b, c)])
end=endpoint(rbase2)
start=best_start(rbase2,t,beg,minblocksize)
slope, intercept, delete1, delete2, delete3 = stats.linregress(t[start:end],rbase2[start:end])
rbasemean, errrorbar =blockAverage((rbase2[start:end]),blocksNum)
print "for SAM ",b,"% and ", c, " molecules:"
if start == None:
print " Not equilibrated!"
sampling = 0
start = beg
end = endpoint(rbase2)
symb='<'
else:
sampling = (end-start)/2.
print "start point=", start, "length of sampling =", sampling, "ns"
print "slope=", slope, "intercept=",intercept
print "average=",rbasemean, "error=",errrorbar
symb='>'
ax = plt.subplot(Nrows, Ncolumns, i+1)
m=str(round(abs(slope)*(end-start)/2.,3))
line1, = ax.plot(t[start:end], func(t[start:end], slope, intercept),'r', label='error '+str(round(2*errrorbar,3))+'$^\circ $'+symb+m+'$^\circ $ shift')
ax.plot(t[start:end], rbase2[start:end],'-',linewidth=0.5)
ax.plot(t[start:end], func(t[start:end], 0, rbasemean))
ax.plot(t[start:end], func(t[start:end], 0, rbasemean+errrorbar),'g-')
ax.plot(t[start:end], func(t[start:end], 0, rbasemean-errrorbar),'g-')
matplotlib.rcParams['font.family'] = 'Arial'
# Set common labels
ax.set_xlabel('time [ns]',fontsize=13)
#plt.ylabel(r'$\theta_{mic}$ [deg]')
ax.set_ylabel(r'R$\ _{BASE} $ [nm]',fontsize=14)
#titles for each subplot:
matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
#####ax.set_title(str(c)+' water molec: $\Delta(t)=$'+str(sampling)+'ns')
ax.set_title(str(c)+' water molec: $\Delta(t)=$'+str(sampling)+'ns',fontweight='bold',fontsize=15)
matplotlib.rcParams['font.family'] = 'Arial'
# Create a legend for the first line.
#first_legend = plt.legend(handles=[line1],bbox_to_anchor=(0.2, 0.9), loc=3,borderaxespad=0.,borderpad=0.2,fontsize=11)
first_legend = plt.legend(loc=1,borderaxespad=0.,borderpad=0.2,fontsize=11)
# Add the legend manually to the current Axes.
ax = plt.gca().add_artist(first_legend)
# SAVING RESULTS
if sampling != 0:
(error_rbase_w[b]).append(errrorbar)
(rbase_w[b]).append(rbasemean)
(start_rbase_w[b]).append(start)
(end_rbase_w[b]).append(end)
(equil_rbase_w[b]).append(c)
i = i+1
matplotlib.rcParams['font.family'] = 'Times New Roman'
mytitle = plt.suptitle(r'Base Radius $R_{base}$ vs. Time for SAM'+str(b)+'%', fontsize=19, fontweight='bold',x=0.7, y=4.65)
###mytitle = plt.suptitle(r'Contact Angle $\theta_{mic}$ vs. Time for SAM'+str(b)+'%', fontsize=17,x=0.7, y=4.65)
plt.show()
fig.savefig('equil_Rbase_t_s'+str(b)+'.jpg',bbox_extra_artists=(first_legend,mytitle,), bbox_inches='tight')
# check for better quality:
# plt.savefig('destination_path.eps', format='eps', dpi=1000)
b=17
minblocksize=20 # The minimum block size is 10ns=20 points
beg = 10 # We leave out the first 5ns=10 points
blocksNum=3 #the function best_start uses also 3 blocks for averaging
Nrows = 5
Ncolumns = 2
fig, ax = plt.subplots(Ncolumns, Nrows)
#fig.subplots_adjust(bottom=0.5,top=2.5, left=0.0, right=1.5, hspace = 0.5)
fig.subplots_adjust(bottom=0.0,top=4.5, left=0.0, right=1.5, hspace = 0.35)
matplotlib.rcParams['legend.handlelength'] = 0
matplotlib.rcParams['legend.markerscale'] = 0
matplotlib.rcParams['legend.handletextpad'] = 0
matplotlib.rcParams['legend.markerscale'] = 2
#matplotlib.rcParams['font.family'] = 'Times New Roman'
#matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
error_rbase_m[b]=[]
rbase_m[b]=[]
start_rbase_m[b]=[]
end_rbase_m[b]=[]
equil_rbase_m[b]=[]
error_rbase_s[b]=[]
rbase_s[b]=[]
start_rbase_s[b]=[]
end_rbase_s[b]=[]
equil_rbase_s[b]=[]
i = 0
for c in Waters:
#for c in [1000]:
n=Waters.index(c)
rbase2_w = array(radii_w[(b, c)])
rbase2_m = array(radii_m[(b, c)])
rbase2_s = array(radii_s[(b, c)])
end=endpoint(rbase2_m)
start=best_start(rbase2_m,t,beg,minblocksize)
rbasemean, errrorbar =blockAverage((rbase2_m[start:end]),blocksNum)
# SAVING RESULTS
if start != None:
(error_rbase_m[b]).append(errrorbar)
(rbase_m[b]).append(rbasemean)
(start_rbase_m[b]).append(start)
(end_rbase_m[b]).append(end)
(equil_rbase_m[b]).append(c)
end=endpoint(rbase2_s)
start=best_start(rbase2_s,t,beg,minblocksize)
rbasemean, errrorbar =blockAverage((rbase2_s[start:end]),blocksNum)
# SAVING RESULTS
if start != None:
(error_rbase_s[b]).append(errrorbar)
(rbase_s[b]).append(rbasemean)
(start_rbase_s[b]).append(start)
(end_rbase_s[b]).append(end)
(equil_rbase_s[b]).append(c)
ax = plt.subplot(Nrows, Ncolumns, i+1)
####line1, = ax.plot(t, rbase2_w,'-',linewidth=0.5)
#ax.plot(t, rbase2_w,'-',linewidth=0.5)
#ax.plot(t, rbase2_m,'-',linewidth=0.5)
#ax.plot(t, rbase2_s,'-',linewidth=0.5)
mylines=ax.plot(t, rbase2_w,'o', t, rbase2_m, 'o', t,rbase2_s,'o')
plt.setp(mylines, markersize=3.0)
matplotlib.rcParams['font.family'] = 'Arial'
# Set common labels
ax.set_xlabel('time [ns]',fontsize=13)
ax.set_ylabel(r'R$\ _{BASE} $ [nm]',fontsize=14)
#titles for each subplot:
matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
ax.set_title(str(c)+' water molec.',fontweight='bold',fontsize=15)
matplotlib.rcParams['font.family'] = 'Arial'
i = i+1
matplotlib.rcParams['font.family'] = 'Times New Roman'
mytitle = plt.suptitle(r'Base Radius $R_{base}$ vs. Time for SAM'+str(b)+'%', fontsize=19, fontweight='bold',x=0.7, y=4.65)
plt.show()
fig.savefig('rbase_t_s'+str(b)+'.jpg',bbox_extra_artists=(first_legend,mytitle,), bbox_inches='tight')
# check for better quality:
# plt.savefig('destination_path.eps', format='eps', dpi=1000)
################################ r_base #################################
b=33
minblocksize=20 # The minimum block size is 10ns=20 points
beg = 10 # We leave out the first 5ns=10 points
blocksNum=3 #the function best_start uses also 3 blocks for averaging
Nrows = 5
Ncolumns = 2
fig, ax = plt.subplots(Ncolumns, Nrows)
#fig.subplots_adjust(bottom=0.5,top=2.5, left=0.0, right=1.5, hspace = 0.5)
fig.subplots_adjust(bottom=0.0,top=4.5, left=0.0, right=1.5, hspace = 0.35)
matplotlib.rcParams['legend.handlelength'] = 0
matplotlib.rcParams['legend.markerscale'] = 0
matplotlib.rcParams['legend.handletextpad'] = 0
matplotlib.rcParams['legend.markerscale'] = 2
#matplotlib.rcParams['font.family'] = 'Times New Roman'
#matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
error_rbase_w[b]=[]
rbase_w[b]=[]
start_rbase_w[b]=[]
end_rbase_w[b]=[]
equil_rbase_w[b]=[]
i = 0
for c in Waters:
#for c in [1000]:
n=Waters.index(c)
rbase2 = array(radii_w[(b, c)])
end=endpoint(rbase2)
start=best_start(rbase2,t,beg,minblocksize)
slope, intercept, delete1, delete2, delete3 = stats.linregress(t[start:end],rbase2[start:end])
rbasemean, errrorbar =blockAverage((rbase2[start:end]),blocksNum)
print "for SAM ",b,"% and ", c, " molecules:"
if start == None:
print " Not equilibrated!"
sampling = 0
start = beg
end = endpoint(rbase2)
symb='<'
else:
sampling = (end-start)/2.
print "start point=", start, "length of sampling =", sampling, "ns"
print "slope=", slope, "intercept=",intercept
print "average=",rbasemean, "error=",errrorbar
symb='>'
ax = plt.subplot(Nrows, Ncolumns, i+1)
m=str(round(abs(slope)*(end-start)/2.,3))
line1, = ax.plot(t[start:end], func(t[start:end], slope, intercept),'r', label='error '+str(round(2*errrorbar,3))+'$^\circ $'+symb+m+'$^\circ $ shift')
ax.plot(t[start:end], rbase2[start:end],'-',linewidth=0.5)
ax.plot(t[start:end], func(t[start:end], 0, rbasemean))
ax.plot(t[start:end], func(t[start:end], 0, rbasemean+errrorbar),'g-')
ax.plot(t[start:end], func(t[start:end], 0, rbasemean-errrorbar),'g-')
matplotlib.rcParams['font.family'] = 'Arial'
# Set common labels
ax.set_xlabel('time [ns]',fontsize=13)
#plt.ylabel(r'$\theta_{mic}$ [deg]')
ax.set_ylabel(r'R$\ _{BASE} $ [nm]',fontsize=14)
#titles for each subplot:
matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
#####ax.set_title(str(c)+' water molec: $\Delta(t)=$'+str(sampling)+'ns')
ax.set_title(str(c)+' water molec: $\Delta(t)=$'+str(sampling)+'ns',fontweight='bold',fontsize=15)
matplotlib.rcParams['font.family'] = 'Arial'
# Create a legend for the first line.
#first_legend = plt.legend(handles=[line1],bbox_to_anchor=(0.2, 0.9), loc=3,borderaxespad=0.,borderpad=0.2,fontsize=11)
first_legend = plt.legend(loc=1,borderaxespad=0.,borderpad=0.2,fontsize=11)
# Add the legend manually to the current Axes.
ax = plt.gca().add_artist(first_legend)
# SAVING RESULTS
if sampling != 0:
(error_rbase_w[b]).append(errrorbar)
(rbase_w[b]).append(rbasemean)
(start_rbase_w[b]).append(start)
(end_rbase_w[b]).append(end)
(equil_rbase_w[b]).append(c)
i = i+1
matplotlib.rcParams['font.family'] = 'Times New Roman'
mytitle = plt.suptitle(r'Base Radius $R_{base}$ vs. Time for SAM'+str(b)+'%', fontsize=19, fontweight='bold',x=0.7, y=4.65)
###mytitle = plt.suptitle(r'Contact Angle $\theta_{mic}$ vs. Time for SAM'+str(b)+'%', fontsize=17,x=0.7, y=4.65)
plt.show()
fig.savefig('equil_Rbase_t_s'+str(b)+'.jpg',bbox_extra_artists=(first_legend,mytitle,), bbox_inches='tight')
# check for better quality:
# plt.savefig('destination_path.eps', format='eps', dpi=1000)
b=33
minblocksize=20 # The minimum block size is 10ns=20 points
beg = 10 # We leave out the first 5ns=10 points
blocksNum=3 #the function best_start uses also 3 blocks for averaging
Nrows = 5
Ncolumns = 2
fig, ax = plt.subplots(Ncolumns, Nrows)
#fig.subplots_adjust(bottom=0.5,top=2.5, left=0.0, right=1.5, hspace = 0.5)
fig.subplots_adjust(bottom=0.0,top=4.5, left=0.0, right=1.5, hspace = 0.35)
matplotlib.rcParams['legend.handlelength'] = 0
matplotlib.rcParams['legend.markerscale'] = 0
matplotlib.rcParams['legend.handletextpad'] = 0
matplotlib.rcParams['legend.markerscale'] = 2
#matplotlib.rcParams['font.family'] = 'Times New Roman'
#matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
error_rbase_m[b]=[]
rbase_m[b]=[]
start_rbase_m[b]=[]
end_rbase_m[b]=[]
equil_rbase_m[b]=[]
error_rbase_s[b]=[]
rbase_s[b]=[]
start_rbase_s[b]=[]
end_rbase_s[b]=[]
equil_rbase_s[b]=[]
i = 0
for c in Waters:
#for c in [1000]:
n=Waters.index(c)
rbase2_w = array(radii_w[(b, c)])
rbase2_m = array(radii_m[(b, c)])
rbase2_s = array(radii_s[(b, c)])
'''
if b>=33 and c>=8000:
print b,c,':'
print 'radii_m[(b, c)][115:120]=',radii_m[(b, c)][115:120]
print 'radii_s[(b, c)][115:120]=',radii_s[(b, c)][115:120]
w=120
print 'radii_w[z][w]=',radii_w[z][w]
print 'radii_m[z][w]=',radii_m[z][w]
print 'radii_s[z][w]=',radii_s[z][w]
print 'rbase2_w[w]=',rbase2_w[w]
print 'rbase2_m[w]=',rbase2_m[w]
print 'rbase2_s[w]=',rbase2_s[w]
'''
end=endpoint(rbase2_m)
start=best_start(rbase2_m,t,beg,minblocksize)
rbasemean, errrorbar =blockAverage((rbase2_m[start:end]),blocksNum)
# SAVING RESULTS
if start != None:
(error_rbase_m[b]).append(errrorbar)
(rbase_m[b]).append(rbasemean)
(start_rbase_m[b]).append(start)
(end_rbase_m[b]).append(end)
(equil_rbase_m[b]).append(c)
end=endpoint(rbase2_s)
start=best_start(rbase2_s,t,beg,minblocksize)
rbasemean, errrorbar =blockAverage((rbase2_s[start:end]),blocksNum)
# SAVING RESULTS
if start != None:
(error_rbase_s[b]).append(errrorbar)
(rbase_s[b]).append(rbasemean)
(start_rbase_s[b]).append(start)
(end_rbase_s[b]).append(end)
(equil_rbase_s[b]).append(c)
ax = plt.subplot(Nrows, Ncolumns, i+1)
####line1, = ax.plot(t, rbase2_w,'-',linewidth=0.5)
#ax.plot(t, rbase2_w,'-',linewidth=0.5)
#ax.plot(t, rbase2_m,'-',linewidth=0.5)
#ax.plot(t, rbase2_s,'-',linewidth=0.5)
mylines=ax.plot(t, rbase2_w,'o', t, rbase2_m, 'o', t,rbase2_s,'o')
plt.setp(mylines, markersize=3.0)
matplotlib.rcParams['font.family'] = 'Arial'
# Set common labels
ax.set_xlabel('time [ns]',fontsize=13)
ax.set_ylabel(r'R$\ _{BASE} $ [nm]',fontsize=14)
#titles for each subplot:
matplotlib.rcParams['font.family'] = 'Times New Roman Bold'
ax.set_title(str(c)+' water molec.',fontweight='bold',fontsize=15)
matplotlib.rcParams['font.family'] = 'Arial'
i = i+1
matplotlib.rcParams['font.family'] = 'Times New Roman'
mytitle = plt.suptitle(r'Base Radius $R_{base}$ vs. Time for SAM'+str(b)+'%', fontsize=19, fontweight='bold',x=0.7, y=4.65)
plt.show()
fig.savefig('rbase_t_s'+str(b)+'.jpg',bbox_extra_artists=(first_legend,mytitle,), bbox_inches='tight')
# check for better quality:
# plt.savefig('destination_path.eps', format='eps', dpi=1000)
z=33,6500
w=7
print angles_w[z][w]
print angles_m[z][w]
print angles_s[z][w]
print radii_w[z][w]
print radii_m[z][w]
print radii_s[z][w]
for i in SAMs:
x = rbase_w[i]
y = theta_w[i]
print "WaterPeak: SAM",i,"%, len(rbase)=",len(x),"len(theta)=",len(y)
x = rbase_m[i]
y = theta_m[i]
print "MiddlePeak: SAM",i,"%, len(rbase)=",len(x),"len(theta)=",len(y)
x = rbase_s[i]
y = theta_s[i]
print "SAMPeak: SAM",i,"%, len(rbase)=",len(x),"len(theta)=",len(y),"\n"
#if x.all() != 0:
#x = 1/x
#y = cos(radians(theta[i]))
print equil_theta_w[11], equil_rbase_w[11]
Nrows = 3
Ncolumns = 2
fig, ax = plt.subplots(Ncolumns, Nrows)
fig.subplots_adjust(bottom=0.0,top=1.5, left=0.0, right=2, hspace = 0.25)
k = 0
for i in [0,5,11,17,33]:
#for i in [11]:
ax = plt.subplot(Nrows, Ncolumns, k+1)
x = []
y = []
x_error = []
y_error = []
mn=min(len(rbase_w[i]),len(theta_w[i]))
for j in range(mn):
x.append(1/rbase_w[i][j])
x_error.append((rbase_w[i][j]**(-2))*error_rbase_w[i][j])
y.append(cos(radians(theta_w[i][j])))
y_error.append(cos(radians(theta_w[i][j]))*radians(errortheta_w[i][j]))
slope, intercept, delete1, delete2, delete3 = stats.linregress(x,y)
yline=np.zeros(len(x))
m=0
for l in x:
yline[m] = func(l, slope, intercept)
m = m+1
line2, = ax.plot(x, yline,'b-',label='SAM'+str(i)+'%, y='+str(round(slope,2))+'x+'+str(round(intercept,2)),linewidth=0.5)
ax.plot(x, y,'x')
#line2, = ax.errorbar(x, y, fmt='--o')
ax.errorbar(x, y,xerr=x_error, yerr=y_error, fmt='x')
###plt.errorbar(x_WaterPeak, y_WaterPeak,xerr=error_x_WaterPeak, yerr=error_y_WaterPeak,fmt='x', ecolor='red',elinewidth=1.5, color='red',markeredgewidth=1.5)
for j in range(mn):
xarrow = x[j]
yarrow = y[j]
xtext = ((x[j])*0.01)+x[j]
ytext = ((y[j])*0.01)+y[j]
#ax.annotate(str(equil_rbase[i][j]), xy=(xarrow,yarrow), xytext=(xtext,ytext),arrowprops=dict(facecolor='yellow', shrink=0.05,
# width=1, headwidth=4),
# horizontalalignment='right', verticalalignment='top',)
#ax.annotate(str(equil_rbase[i][j]), xytext=(xtext,ytext), xy=(xarrow,yarrow),horizontalalignment='right', verticalalignment='top',)
# Set common labels
ax.set_ylabel(r'$cos(\theta_{mic})$ ',fontsize=14)
ax.set_xlabel('${R \ _{BASE}}^{-1}\ [ nm ^{-1} ]$',fontsize=13)
#titles for each subplot:
#ax.set_title('ax1 title')
# Create a legend for the first line.
first_legend = plt.legend(handles=[line2],bbox_to_anchor=(0.2, 0.95), loc=3,borderaxespad=0.)
# Add the legend manually to the current Axes.
ax = plt.gca().add_artist(first_legend)
# Set size of subplots
fig.subplots_adjust(top=4.5)
plt.grid(True)
k = k + 1
mytitle = plt.suptitle(r'$cos(\theta_{mic})$ vs 1/R$\ _{BASE} $', fontsize=19, fontweight='bold', x=1.0, y=4.6)
plt.show()
fig.savefig('all_cos_r.jpg',bbox_extra_artists=(first_legend,mytitle,), bbox_inches='tight')
i=0
x = []
y = []
x_error = []
y_error = []
mn=min(len(rbase_w[i]),len(theta_w[i]))
for j in range(mn):
x.append(1/rbase_w[i][j])
x_error.append((rbase_w[i][j]**(-2))*error_rbase_w[i][j])
y.append(cos(radians(theta_w[i][j])))
y_error.append(cos(radians(theta_w[i][j]))*radians(errortheta_w[i][j]))
slope, intercept, delete1, delete2, delete3 = stats.linregress(x,y)
yline=np.zeros(len(x))
m=0
for l in x:
yline[m] = func(l, slope, intercept)
m = m+1
print "Checking vector lengths..."
print len(x),len(y),len(x_error),len(y_error)
print "x=",x
print "y=",y
print "x_error=",x_error
print "y_error=",y_error
# PLOT INSTEAD OF SUBPLOT
plt.figure()
plt.errorbar(x, y, xerr=x_error, yerr=y_error,fmt='x', ecolor='red',elinewidth=1.5, color='black',markeredgewidth=1.5)
plt.plot(x, yline, color='r')
plt.plot(x, y, '-')
plt.xlabel('${R \ _{BASE}}^{-1}\ [ nm ^{-1} ]$',fontsize=13)
plt.ylabel(r' $\cos\Theta_{mic}$ ',fontsize=14)
mytitle = plt.suptitle(r'$\cos\Theta_{mic}$ vs. ${R \ _{BASE}}^{-1}$ for SAM '+str(i)+'%', fontsize=15,fontweight='bold')
# Labels next to each point
for j in range(mn):
xarrow = x[j]
yarrow =y[j] + ((y[j])*0.004)
xtext = x[j]
ytext = y[j] + ((y[j])*0.01)
plt.annotate(str(equil_rbase_w[i][j]), xy=(xarrow,yarrow), xytext=(xtext,ytext),arrowprops=dict(facecolor='yellow', shrink=0.05,
width=1, headwidth=4),
horizontalalignment='right', verticalalignment='top',)
#ax.annotate(str(equil_rbase[i][j]), xytext=(xtext,ytext), xy=(xarrow,yarrow),horizontalalignment='right', verticalalignment='top',)
plt.grid(True)
#plt.axis([0.3, 0.9, -1.0, 0.0])
plt.show()
fig.savefig('s'+str(i)+'_cos_r.jpg',bbox_extra_artists=(mytitle,), bbox_inches='tight')
i=5
x = []
y = []
x_error = []
y_error = []
mn=min(len(rbase_w[i]),len(theta_w[i]))
for j in range(mn):
x.append(1/rbase_w[i][j])
x_error.append((rbase_w[i][j]**(-2))*error_rbase_w[i][j])
y.append(cos(radians(theta_w[i][j])))
y_error.append(cos(radians(theta_w[i][j]))*radians(errortheta_w[i][j]))
slope, intercept, delete1, delete2, delete3 = stats.linregress(x,y)
yline=np.zeros(len(x))
m=0
for l in x:
yline[m] = func(l, slope, intercept)
m = m+1
print "Checking vector lengths..."
print len(x),len(y),len(x_error),len(y_error)
print "x=",x
print "y=",y
print "x_error=",x_error
print "y_error=",y_error
# PLOT INSTEAD OF SUBPLOT
plt.figure()
plt.errorbar(x, y, xerr=x_error, yerr=y_error,fmt='x', ecolor='red',elinewidth=1.5, color='black',markeredgewidth=1.5)
plt.plot(x, yline, color='r')
plt.plot(x, y, '-')
plt.xlabel('${R \ _{BASE}}^{-1}\ [ nm ^{-1} ]$',fontsize=13)
plt.ylabel(r' $\cos\Theta_{mic}$ ',fontsize=14)
mytitle = plt.suptitle(r'$\cos\Theta_{mic}$ vs. ${R \ _{BASE}}^{-1}$ for SAM '+str(i)+'%', fontsize=15,fontweight='bold')
# Labels next to each point
for j in range(mn):
xarrow = x[j]
yarrow =y[j] + ((y[j])*0.01)
xtext = x[j]
ytext = y[j] + ((y[j])*0.03)
plt.annotate(str(equil_rbase_w[i][j]), xy=(xarrow,yarrow), xytext=(xtext,ytext),arrowprops=dict(facecolor='yellow', shrink=0.05,
width=1, headwidth=4),
horizontalalignment='right', verticalalignment='top',)
#ax.annotate(str(equil_rbase[i][j]), xytext=(xtext,ytext), xy=(xarrow,yarrow),horizontalalignment='right', verticalalignment='top',)
plt.grid(True)
#plt.axis([0.3, 0.9, -1.0, 0.0])
plt.show()
fig.savefig('s'+str(i)+'_cos_r.jpg',bbox_extra_artists=(mytitle,), bbox_inches='tight')
i=11
#we change the label of water 9000
#equil_rbase_w[i].append(10000)
#equil_rbase_w[i][9]=[]
print equil_theta_w[i]
x = []
y = []
x_error = []
y_error = []
mn=min(len(rbase_w[i]),len(theta_w[i]))
for j in range(mn):
x.append(1/rbase_w[i][j])
x_error.append((rbase_w[i][j]**(-2))*error_rbase_w[i][j])
y.append(cos(radians(theta_w[i][j])))
y_error.append(cos(radians(theta_w[i][j]))*radians(errortheta_w[i][j]))
slope, intercept, delete1, delete2, delete3 = stats.linregress(x,y)
yline=np.zeros(len(x))
m=0
for l in x:
yline[m] = func(l, slope, intercept)
m = m+1
print "Checking vector lengths..."
print len(x),len(y),len(x_error),len(y_error)
print "x=",x
print "y=",y
print "x_error=",x_error
print "y_error=",y_error
# PLOT INSTEAD OF SUBPLOT
plt.figure()
plt.errorbar(x, y, xerr=x_error, yerr=y_error,fmt='.', ecolor='red',elinewidth=1.5, color='black',markeredgewidth=1.5)
plt.plot(x, yline, color='r')
plt.plot(x, y, '-')
plt.xlabel('${R \ _{BASE}}^{-1}\ [ nm ^{-1} ]$',fontsize=13)
plt.ylabel(r' $\cos\Theta_{mic}$ ',fontsize=14)
mytitle = plt.suptitle(r'$\cos\Theta_{mic}$ vs. ${R \ _{BASE}}^{-1}$ for SAM '+str(i)+'%', fontsize=15,fontweight='bold')
# Labels next to each point
for j in range(mn):
xarrow = x[j]
yarrow =y[j] + ((y[j])*0.01)
xtext = x[j]
ytext = y[j] + ((y[j])*0.03)
plt.annotate(str(equil_theta_w[i][j]), xy=(xarrow,yarrow), xytext=(xtext,ytext),arrowprops=dict(facecolor='yellow', shrink=0.05,
width=1, headwidth=4),
horizontalalignment='right', verticalalignment='top',)
#ax.annotate(str(equil_rbase[i][j]), xytext=(xtext,ytext), xy=(xarrow,yarrow),horizontalalignment='right', verticalalignment='top',)
plt.grid(True)
#plt.axis([0.3, 0.9, -1.0, 0.0])
plt.show()
fig.savefig('s'+str(i)+'_cos_r.jpg',bbox_extra_artists=(mytitle,), bbox_inches='tight')
i=17
x = []
y = []
x_error = []
y_error = []
mn=min(len(rbase_w[i]),len(theta_w[i]))
for j in range(mn):
x.append(1/rbase_w[i][j])
x_error.append((rbase_w[i][j]**(-2))*error_rbase_w[i][j])
y.append(cos(radians(theta_w[i][j])))
y_error.append(cos(radians(theta_w[i][j]))*radians(errortheta_w[i][j]))
slope, intercept, delete1, delete2, delete3 = stats.linregress(x,y)
yline=np.zeros(len(x))
m=0
for l in x:
yline[m] = func(l, slope, intercept)
m = m+1
print "Checking vector lengths..."
print len(x),len(y),len(x_error),len(y_error)
print "x=",x
print "y=",y
print "x_error=",x_error
print "y_error=",y_error
# PLOT INSTEAD OF SUBPLOT
plt.figure()
plt.errorbar(x, y, xerr=x_error, yerr=y_error,fmt='x', ecolor='red',elinewidth=1.5, color='black',markeredgewidth=1.5)
plt.plot(x, yline, color='r')
plt.plot(x, y, '-')
plt.xlabel('${R \ _{BASE}}^{-1}\ [ nm ^{-1} ]$',fontsize=13)
plt.ylabel(r' $\cos\Theta_{mic}$ ',fontsize=14)
mytitle = plt.suptitle(r'$\cos\Theta_{mic}$ vs. ${R \ _{BASE}}^{-1}$ for SAM '+str(i)+'%', fontsize=15,fontweight='bold')
# Labels next to each point
for j in range(mn):
xarrow = x[j]
yarrow =y[j] + ((y[j])*0.04)
xtext = x[j]
ytext = y[j] + ((y[j])*0.1)
plt.annotate(str(equil_rbase_w[i][j]), xy=(xarrow,yarrow), xytext=(xtext,ytext),arrowprops=dict(facecolor='yellow', shrink=0.05,
width=1, headwidth=4),
horizontalalignment='right', verticalalignment='top',)
#ax.annotate(str(equil_rbase[i][j]), xytext=(xtext,ytext), xy=(xarrow,yarrow),horizontalalignment='right', verticalalignment='top',)
plt.grid(True)
#plt.axis([0.3, 0.9, -1.0, 0.0])
plt.show()
fig.savefig('s'+str(i)+'_cos_r.jpg',bbox_extra_artists=(mytitle,), bbox_inches='tight')
i=33
x = []
y = []
x_error = []
y_error = []
mn=min(len(rbase_w[i]),len(theta_w[i]))
for j in range(mn):
x.append(1/rbase_w[i][j])
x_error.append((rbase_w[i][j]**(-2))*error_rbase_w[i][j])
y.append(cos(radians(theta_w[i][j])))
y_error.append(cos(radians(theta_w[i][j]))*radians(errortheta_w[i][j]))
slope, intercept, delete1, delete2, delete3 = stats.linregress(x,y)
yline=np.zeros(len(x))
m=0
for l in x:
yline[m] = func(l, slope, intercept)
m = m+1
print "Checking vector lengths..."
print len(x),len(y),len(x_error),len(y_error)
print "x=",x
print "y=",y
print "x_error=",x_error
print "y_error=",y_error
# PLOT INSTEAD OF SUBPLOT
plt.figure()
plt.errorbar(x, y, xerr=x_error, yerr=y_error,fmt='x', ecolor='red',elinewidth=1.5, color='black',markeredgewidth=1.5)
plt.plot(x, yline, color='r')
plt.xlabel('${R \ _{BASE}}^{-1}\ [ nm ^{-1} ]$',fontsize=13)
plt.ylabel(r' $\cos\Theta_{mic}$ ',fontsize=14)
mytitle = plt.suptitle(r'$\cos\Theta_{mic}$ vs. ${R \ _{BASE}}^{-1}$ for SAM '+str(i)+'%', fontsize=15,fontweight='bold')
# Labels next to each point
for j in range(mn):
#xarrow = x[j] + ((x[j])*0.02)
xarrow = x[j]
yarrow =y[j] + ((y[j])*0.02)
#xtext = x[j] + ((x[j])*0.1)
xtext = x[j]
ytext = y[j] + ((y[j])*0.1)
plt.annotate(str(equil_rbase_w[i][j]), xy=(xarrow,yarrow), xytext=(xtext,ytext),arrowprops=dict(facecolor='yellow', shrink=0.05,
width=1, headwidth=4),
horizontalalignment='right', verticalalignment='top',)
#ax.annotate(str(equil_rbase[i][j]), xytext=(xtext,ytext), xy=(xarrow,yarrow),horizontalalignment='right', verticalalignment='top',)
plt.grid(True)
#plt.axis([0.3, 0.9, -1.0, 0.0])
plt.show()
fig.savefig('s'+str(i)+'_cos_r.jpg',bbox_extra_artists=(mytitle,), bbox_inches='tight')
# IN THE NEXT CELL (BEFORE 3 SEPARATE CELLS) WE REMOVE 2 DATA POINTS FROM SAM33%
# FROM THE DROPLETS WITH 6500 & 7000 MOLECULES
i=33
print len(theta_w[i])
print theta_w[i]
print theta_w[i][0:5]
print theta_w[i][7:11]
print len(rbase_w[i])
print rbase_w[i]
print rbase_w[i][0:5]
print rbase_w[i][7:11]
print len(equil_rbase_w[i])
print equil_rbase_w[i]
print len(equil_rbase_m[i])
print equil_rbase_m[i]
print len(equil_rbase_s[i])
print equil_rbase_s[i]
# RUN ONLY ONCE!!
# IN THE NEXT CELL (BEFORE 3 SEPARATE CELLS) WE REMOVE ONE DATA POINT FROM rbase TO BE ABLE TO PLOT THE RESULTS OF SAM11%
# THE DATA POINT REMOVED CORRESPONDS TO THE DROPLETS WITH 6500 and 7000 MOLECULES
i=33
'''
theta_w[i][5:7]=[]
rbase_w[i][5:7]=[]
equil_rbase_w[i][5:7]=[]
theta_m[i][5:7]=[]
rbase_m[i][5:7]=[]
equil_rbase_m[i][5:7]=[]
theta_s[i][5:7]=[]
rbase_s[i][5:7]=[]
equil_rbase_s[i][5:7]=[]
print len(equil_rbase_s[i])
print len(theta_w[i])
print theta_w[i]
print len(rbase_w[i])
print rbase_w[i]
errortheta_w[i][5:7]=[]
error_rbase_w[i][5:7]=[]
errortheta_m[i][5:7]=[]
error_rbase_m[i][5:7]=[]
errortheta_s[i][5:7]=[]
error_rbase_s[i][5:7]=[]
print len(error_rbase_w[i])
print len(error_rbase_m[i])
print len(error_rbase_s[i])
print len(errortheta_w[i])
print len(errortheta_m[i])
print len(errortheta_s[i])
'''
# third cell
i=33
x = []
y = []
x_error = []
y_error = []
mn=min(len(rbase_w[i]),len(theta_w[i]))
for j in range(mn):
x.append(1/rbase_w[i][j])
x_error.append((rbase_w[i][j]**(-2))*error_rbase_w[i][j])
y.append(cos(radians(theta_w[i][j])))
y_error.append(cos(radians(theta_w[i][j]))*radians(errortheta_w[i][j]))
print "Checking vector lengths..."
print len(x),len(y),len(x_error),len(y_error)
print "x=",x
print "y=",y
print "x_error=",x_error
print "y_error=",y_error
slope, intercept, delete1, delete2, delete3 = stats.linregress(x,y)
yline=np.zeros(len(x))
m=0
for l in x:
yline[m] = func(l, slope, intercept)
m = m+1
# PLOT INSTEAD OF SUBPLOT
plt.figure()
plt.errorbar(x, y, xerr=x_error, yerr=y_error,fmt='x', ecolor='red',elinewidth=1.5, color='black',markeredgewidth=1.5)
plt.plot(x, yline, color='r')
plt.xlabel('${R \ _{BASE}}^{-1}\ [ nm ^{-1} ]$',fontsize=13)
plt.ylabel(r' $\cos\Theta_{mic}$ ',fontsize=14)
mytitle = plt.suptitle(r'$\cos\Theta_{mic}$ vs. ${R \ _{BASE}}^{-1}$ for SAM '+str(i)+'%', fontsize=15,fontweight='bold')
# Labels next to each point
for j in range(mn):
xarrow = x[j]
yarrow =y[j] + ((y[j])*0.01)
xtext = x[j]
ytext = y[j] + ((y[j])*0.03)
plt.annotate(str(equil_rbase_w[i][j]), xy=(xarrow,yarrow), xytext=(xtext,ytext),arrowprops=dict(facecolor='yellow', shrink=0.05,
width=1, headwidth=4),
horizontalalignment='right', verticalalignment='top',)
#ax.annotate(str(equil_rbase[i][j]), xytext=(xtext,ytext), xy=(xarrow,yarrow),horizontalalignment='right', verticalalignment='top',)
plt.grid(True)
#plt.axis([0.3, 0.9, -1.0, 0.0])
plt.show()
fig.savefig('s'+str(i)+'_cos_r.jpg',bbox_extra_artists=(mytitle,), bbox_inches='tight')
# WE PLOT THE CORRECTED PLOTS OF SAM 33% AND 11% TOGETHER WITH THE REST.
slopes_all_w=[]
intercepts_all_w=[]
Nrows = 3
Ncolumns = 2
fig, ax = plt.subplots(Ncolumns, Nrows)
fig.subplots_adjust(bottom=0.0,top=1.5, left=0.0, right=2, hspace = 0.3)
k = 0
for i in [0,5,11,17,33]:
ax = plt.subplot(Nrows, Ncolumns, k+1)
x = []
y = []
x_error = []
y_error = []
#mn=min(len(rbase_w[i]),len(theta_w[i]))
mn=len(theta_w[i])
print mn
for j in range(mn):
x.append(1/rbase_w[i][j])
x_error.append((rbase_w[i][j]**(-2))*error_rbase_w[i][j])
y.append(cos(radians(theta_w[i][j])))
y_error.append(cos(radians(theta_w[i][j]))*radians(errortheta_w[i][j]))
slope, intercept, delete1, delete2, delete3 = stats.linregress(x,y)
slopes_all_w.append(slope)
intercepts_all_w.append(intercept)
yline=np.zeros(len(x))
m=0
for l in x:
yline[m] = func(l, slope, intercept)
m = m+1
line2, = ax.plot(x, yline,'b-',label='SAM'+str(i)+'%, y='+str(round(slope,2))+'x+'+str(round(intercept,2)),linewidth=0.5)
#ax.plot(x, y,'x')
#line2, = ax.errorbar(x, y, fmt='--o')
ax.errorbar(x, y,xerr=x_error, yerr=y_error, fmt='k.')
###plt.errorbar(x_WaterPeak, y_WaterPeak,xerr=error_x_WaterPeak, yerr=error_y_WaterPeak,fmt='x', ecolor='red',elinewidth=1.5, color='red',markeredgewidth=1.5)
for j in range(mn):
xarrow = x[j]
yarrow = y[j]
xtext = ((x[j])*0.01)+x[j]
ytext = ((y[j])*0.01)+y[j]
#ax.annotate(str(equil_rbase[i][j]), xy=(xarrow,yarrow), xytext=(xtext,ytext),arrowprops=dict(facecolor='yellow', shrink=0.05,
# width=1, headwidth=4),
# horizontalalignment='right', verticalalignment='top',)
#ax.annotate(str(equil_rbase[i][j]), xytext=(xtext,ytext), xy=(xarrow,yarrow),horizontalalignment='right', verticalalignment='top',)
# Set common labels
ax.set_ylabel(r'$cos(\theta_{mic})$ ',fontsize=15)
ax.set_xlabel('${R \ _{BASE}}^{-1}\ [ nm ^{-1} ]$',fontsize=13)
#titles for each subplot:
#ax.set_title('ax1 title')
# Create a legend for the first line.
first_legend = plt.legend(handles=[line2], loc=1,borderaxespad=0.)
# Add the legend manually to the current Axes.
ax = plt.gca().add_artist(first_legend)
# Set size of subplots
fig.subplots_adjust(top=4.5)
plt.grid(True)
k = k + 1
mytitle = plt.suptitle(r'$cos(\theta_{mic})$ vs 1/R$\ _{BASE} $', fontsize=19, fontweight='bold', x=1.0, y=4.6)
plt.show()
fig.savefig('2all_cos_r.jpg',bbox_extra_artists=(first_legend,mytitle,), bbox_inches='tight')
# WITHOUT ERRORBARS, AND SYMBOLS AS LEGEND MARKERS (good for white/black print)
# PLOTS SCALED EQUALLY WITH PRESSURE TENSOR RESULTS AND 3 DEFINITIONS OF Z=0
#(for the 3 def. of z=0)
slopes_all_w=[]
intercepts_all_w=[]
slopes_all_m=[]
intercepts_all_m=[]
slopes_all_s=[]
intercepts_all_s=[]
line1=[]
line2=[]
line3=[]
line4=[]
line5=[]
Nrows = 3
Ncolumns = 2
fig, ax = plt.subplots(Ncolumns, Nrows)
fig.subplots_adjust(bottom=0.0,top=1.5, left=0.0, right=2, hspace = 0.3)
matplotlib.rcParams['legend.handlelength'] = 1 #the length of the legend handles
matplotlib.rcParams['legend.markerscale'] = 0.9
matplotlib.rcParams['legend.handletextpad'] = 0.8 #the pad between the legend handle and text
matplotlib.rcParams['font.family'] = 'Times New Roman'
#rcParams['legend.numpoints'] = 1
k = 0
for i in [0,5,11,17,33]:
ax = plt.subplot(Nrows, Ncolumns, k+1)
x_w = []
y_w = []
x_error_w = []
y_error_w = []
#mn=min(len(rbase_w[i]),len(theta_w[i]))
mn=len(theta_w[i])
for j in range(mn):
x_w.append(1/rbase_w[i][j])
x_error_w.append((rbase_w[i][j]**(-2))*error_rbase_w[i][j])
y_w.append(cos(radians(theta_w[i][j])))
y_error_w.append(cos(radians(theta_w[i][j]))*radians(errortheta_w[i][j]))
slope, intercept, delete1, delete2, delete3 = stats.linregress(x_w,y_w)
slopes_all_w.append(slope)
intercepts_all_w.append(intercept)
m=0
l_w=arange(0,1.3,0.1)
yline_w=np.zeros(len(l_w))
for l in l_w:
yline_w[m] = func(l, slope, intercept)
m = m+1
x_m = []
y_m = []
x_error_m = []
y_error_m = []
#mn=min(len(rbase_m[i]),len(theta_m[i]))
mn=len(theta_m[i])
for j in range(mn):
x_m.append(1/rbase_m[i][j])
x_error_m.append((rbase_m[i][j]**(-2))*error_rbase_m[i][j])
y_m.append(cos(radians(theta_m[i][j])))
y_error_m.append(cos(radians(theta_m[i][j]))*radians(errortheta_m[i][j]))
slope, intercept, delete1, delete2, delete3 = stats.linregress(x_m,y_m)
slopes_all_m.append(slope)
intercepts_all_m.append(intercept)
m=0
l_m=arange(0,1.3,0.1)
yline_m=np.zeros(len(l_m))
for l in l_m:
yline_m[m] = func(l, slope, intercept)
m = m+1
x_s = []
y_s = []
x_error_s = []
y_error_s = []
#mn=min(len(rbase_s[i]),len(theta_s[i]))
mn=len(theta_s[i])
for j in range(mn):
x_s.append(1/rbase_s[i][j])
x_error_s.append((rbase_s[i][j]**(-2))*error_rbase_s[i][j])
y_s.append(cos(radians(theta_s[i][j])))
y_error_s.append(cos(radians(theta_s[i][j]))*radians(errortheta_s[i][j]))
slope, intercept, delete1, delete2, delete3 = stats.linregress(x_s,y_s)
slopes_all_s.append(slope)
intercepts_all_s.append(intercept)
m=0
#for l in max(x_s):
l_s=arange(0,1.3,0.1)
yline_s=np.zeros(len(l_s))
for l in l_s:
yline_s[m] = func(l, slope, intercept)
m = m+1
if intercept<0:
signtext='x'
else:
signtext='x+'
##############matplotlib.rcParams['legend.markerscale'] = 15
#plot of the fitted lines
line2, = ax.plot(x_w, y_w,'c^',markersize=8,label='Water Peak, y = '+str(round(slopes_all_w[k],2))+signtext+str(round(intercepts_all_w[k],2)))
line3, =ax.plot(x_m, y_m,'o',markersize=7,color='orange',label='Middle Point, y = '+str(round(slopes_all_m[k],2))+signtext+str(round(intercepts_all_m[k],2)))
line4, =ax.plot(x_s, y_s,'gs',markersize=7,label='SAM Peak, y = '+str(round(slopes_all_s[k],2))+signtext+str(round(intercepts_all_s[k],2)))
#plot of the data points
ax.plot(l_w, yline_w,'c')
ax.plot(l_m, yline_m,color='orange')
ax.plot(l_s, yline_s,'g')
#plot of a black line through y=0
zeropoints=np.zeros(len(l_w))
ax.plot(l_w, zeropoints,'k--')
##############matplotlib.rcParams['legend.markerscale'] = 0.7
#plot of pressure tensor point
line5, =ax.plot(0,cos(ptensor[k]),'ro',markersize=10, label="Pressure Tensor Method")
ax.set_xlim([0,1.1])
ax.set_ylim([-1,+1])
# Set common labels
ax.set_ylabel(r'$cos(\theta_{mic})$ ',fontsize=15)
ax.set_xlabel('${R \ _{BASE}}^{-1}\ [ nm ^{-1} ]$',fontsize=13)
#titles for each subplot:
mysubtitle=ax.set_title('SAM '+str(i)+'%',fontweight='bold',fontsize=14)
plt.setp(mysubtitle, color='darkgreen') #set the color of title to white
# Create a legend for the first line.
first_legend = plt.legend(handles=[line2,line3,line4,line5], loc=1,borderaxespad=0.)
first_legend.markerscale=0.7
# Add the legend manually to the current Axes.
ax = plt.gca().add_artist(first_legend)
# Set size of subplots
fig.subplots_adjust(top=4.5)
#plt.grid(True)
k = k + 1
#r'$cos(\theta_{mic})$ vs 1/R$\ _{BASE} $'
titletext='On the same Scale: '+ r'$cos(\theta_{mic})$' +' vs 1/R$\ _{BASE} $ for three Definitions \n of $z=0$ together with Pressure Tensor Results'
mytitle = plt.suptitle(titletext, fontsize=20, fontweight='bold', x=1.0, y=4.7)
plt.show()
fig.savefig('scaled_all_cos_r.jpg',bbox_extra_artists=(first_legend,mytitle,), bbox_inches='tight')
# WITH ERRORBARS: PLOTS SCALED EQUALLY WITH PRESSURE TENSOR RESULTS AND 3 DEFINITIONS OF Z=0
#(for the 3 def. of z=0)
slopes_all_w=[]
intercepts_all_w=[]
slopes_all_m=[]
intercepts_all_m=[]
slopes_all_s=[]
intercepts_all_s=[]
line1=[]
line2=[]
line3=[]
line4=[]
line5=[]
Nrows = 3
Ncolumns = 2
fig, ax = plt.subplots(Ncolumns, Nrows)
fig.subplots_adjust(bottom=0.0,top=1.5, left=0.0, right=2, hspace = 0.3)
matplotlib.rcParams['legend.handlelength'] = 1 #the length of the legend handles
matplotlib.rcParams['legend.markerscale'] = 1.5
matplotlib.rcParams['legend.handletextpad'] = 0.7 #the pad between the legend handle and text
matplotlib.rcParams['font.family'] = 'Times New Roman'
#rcParams['legend.numpoints'] = 1
k = 0
for i in [0,5,11,17,33]:
ax = plt.subplot(Nrows, Ncolumns, k+1)
x_w = []
y_w = []
x_error_w = []
y_error_w = []
#mn=min(len(rbase_w[i]),len(theta_w[i]))
mn=len(theta_w[i])
for j in range(mn):
x_w.append(1/rbase_w[i][j])
x_error_w.append((rbase_w[i][j]**(-2))*error_rbase_w[i][j])
y_w.append(cos(radians(theta_w[i][j])))
y_error_w.append(cos(radians(theta_w[i][j]))*radians(errortheta_w[i][j]))
slope, intercept, delete1, delete2, delete3 = stats.linregress(x_w,y_w)
slopes_all_w.append(slope)
intercepts_all_w.append(intercept)
m=0
l_w=arange(0,1.3,0.1)
yline_w=np.zeros(len(l_w))
for l in l_w:
yline_w[m] = func(l, slope, intercept)
m = m+1
x_m = []
y_m = []
x_error_m = []
y_error_m = []
#mn=min(len(rbase_m[i]),len(theta_m[i]))
mn=len(theta_m[i])
for j in range(mn):
x_m.append(1/rbase_m[i][j])
x_error_m.append((rbase_m[i][j]**(-2))*error_rbase_m[i][j])
y_m.append(cos(radians(theta_m[i][j])))
y_error_m.append(cos(radians(theta_m[i][j]))*radians(errortheta_m[i][j]))
slope, intercept, delete1, delete2, delete3 = stats.linregress(x_m,y_m)
slopes_all_m.append(slope)
intercepts_all_m.append(intercept)
m=0
l_m=arange(0,1.3,0.1)
yline_m=np.zeros(len(l_m))
for l in l_m:
yline_m[m] = func(l, slope, intercept)
m = m+1
x_s = []
y_s = []
x_error_s = []
y_error_s = []
#mn=min(len(rbase_s[i]),len(theta_s[i]))
mn=len(theta_s[i])
for j in range(mn):
x_s.append(1/rbase_s[i][j])
x_error_s.append((rbase_s[i][j]**(-2))*error_rbase_s[i][j])
y_s.append(cos(radians(theta_s[i][j])))
y_error_s.append(cos(radians(theta_s[i][j]))*radians(errortheta_s[i][j]))
slope, intercept, delete1, delete2, delete3 = stats.linregress(x_s,y_s)
slopes_all_s.append(slope)
intercepts_all_s.append(intercept)
m=0
#for l in max(x_s):
l_s=arange(0,1.3,0.1)
yline_s=np.zeros(len(l_s))
for l in l_s:
yline_s[m] = func(l, slope, intercept)
m = m+1
if intercept<0:
signtext='x'
else:
signtext='x+'
#plot of the fitted lines
#line2, = ax.plot(x_w, y_w,'c^',markersize=8,label='Water Peak, y = '+str(round(slopes_all_w[k],2))+signtext+str(round(intercepts_all_w[k],2)),linewidth=0.9)
#line3, =ax.plot(x_m, y_m,'bo',label='Middle Point, y = '+str(round(slopes_all_m[k],2))+signtext+str(round(intercepts_all_m[k],2)),linewidth=0.9)
#line4, =ax.plot(x_s, y_s,'gs',label='SAM Peak, y = '+str(round(slopes_all_s[k],2))+signtext+str(round(intercepts_all_s[k],2)),linewidth=0.9)
matplotlib.rcParams['legend.markerscale'] = 1.5
#plot of the data points
line2, = ax.plot(l_w, yline_w,'c',label='Water Peak, y = '+str(round(slopes_all_w[k],2))+signtext+str(round(intercepts_all_w[k],2)),linewidth=0.9)
line3, = ax.plot(l_m, yline_m,color='orange',label='Middle Point, y = '+str(round(slopes_all_m[k],2))+signtext+str(round(intercepts_all_m[k],2)),linewidth=0.9)
line4, = ax.plot(l_s, yline_s,'g',label='SAM Peak, y = '+str(round(slopes_all_s[k],2))+signtext+str(round(intercepts_all_s[k],2)),linewidth=0.9)
#plot of a black line through y=0
zeropoints=np.zeros(len(l_w))
ax.plot(l_w, zeropoints,'k--')
#plots of errorbars
ax.errorbar(x_w, y_w,xerr=x_error_w, yerr=y_error_w, fmt='c.',markersize=8,label='Water Peak, y = '+str(round(slopes_all_w[k],2))+signtext+str(round(intercepts_all_w[k],2)),linewidth=0.9)
ax.errorbar(x_m, y_m,xerr=x_error_m, yerr=y_error_m, fmt='.',color='orange' ,label='Middle Point, y = '+str(round(slopes_all_m[k],2))+signtext+str(round(intercepts_all_m[k],2)),linewidth=0.9)
ax.errorbar(x_s, y_s,xerr=x_error_s, yerr=y_error_s, fmt='g.',label='SAM Peak, y = '+str(round(slopes_all_s[k],2))+signtext+str(round(intercepts_all_s[k],2)),linewidth=0.9)
#other options for errorbars: ecolor='red',elinewidth=1.5, color='red',markeredgewidth=1.5
ax.set_xlim([0,1.1])
ax.set_ylim([-1,+1])
# Set common labels
ax.set_ylabel(r'$cos(\theta_{mic})$ ',fontsize=15)
ax.set_xlabel('${R \ _{BASE}}^{-1}\ [ nm ^{-1} ]$',fontsize=13)
#titles for each subplot:
mysubtitle=ax.set_title('SAM '+str(i)+'%',fontweight='bold',fontsize=14)
plt.setp(mysubtitle, color='darkgreen') #set the color of title to white
matplotlib.rcParams['legend.markerscale'] = 0.8
#plot of pressure tensor point
line5, =ax.plot(0,cos(ptensor[k]),'ro',markersize=10, label="Pressure Tensor")
# Create a legend for the first line.
first_legend = plt.legend(handles=[line2,line3,line4,line5], loc=1,borderaxespad=0.)
# Add the legend manually to the current Axes.
ax = plt.gca().add_artist(first_legend)
# Set size of subplots
fig.subplots_adjust(top=4.5)
#plt.grid(True)
k = k + 1
#r'$cos(\theta_{mic})$ vs 1/R$\ _{BASE} $'
titletext='On the Same Scale: '+ r'$cos(\theta_{mic})$' +' vs 1/R$\ _{BASE} $ for Three Definitions \n OF $z=0$ Together with Pressure Tensor Results'
mytitle = plt.suptitle(titletext, fontsize=20, fontweight='bold', x=1.0, y=4.7)
plt.show()
fig.savefig('scaled_errors_all_cos_r.jpg',bbox_extra_artists=(first_legend,mytitle,), bbox_inches='tight')
# WITH ERRORBARS: PLOTS SCALED EQUALLY WITH PRESSURE TENSOR RESULTS AND 3 DEFINITIONS OF Z=0
#(for the 3 def. of z=0)
slopes_all_w=[]
intercepts_all_w=[]
slopes_all_m=[]
intercepts_all_m=[]
slopes_all_s=[]
intercepts_all_s=[]
line1=[]
line2=[]
line3=[]
line4=[]
line5=[]
Nrows = 3
Ncolumns = 2
fig, ax = plt.subplots(Ncolumns, Nrows)
fig.subplots_adjust(bottom=0.0,top=1.5, left=0.0, right=2, hspace = 0.3)
matplotlib.rcParams['legend.handlelength'] = 1 #the length of the legend handles
matplotlib.rcParams['legend.markerscale'] = 1.5
matplotlib.rcParams['legend.handletextpad'] = 0.7 #the pad between the legend handle and text
matplotlib.rcParams['font.family'] = 'Times New Roman'
#rcParams['legend.numpoints'] = 1
k = 0
for i in [0,5,11,17,33]:
ax = plt.subplot(Nrows, Ncolumns, k+1)
x_w = []
y_w = []
x_error_w = []
y_error_w = []
#mn=min(len(rbase_w[i]),len(theta_w[i]))
mn=len(theta_w[i])
for j in range(mn):
x_w.append(1/rbase_w[i][j])
x_error_w.append((rbase_w[i][j]**(-2))*error_rbase_w[i][j])
y_w.append(cos(radians(theta_w[i][j])))
y_error_w.append(cos(radians(theta_w[i][j]))*radians(errortheta_w[i][j]))
slope, intercept, delete1, delete2, delete3 = stats.linregress(x_w,y_w)
slopes_all_w.append(slope)
intercepts_all_w.append(intercept)
m=0
l_w=arange(0,1.3,0.1)
yline_w=np.zeros(len(l_w))
for l in l_w:
yline_w[m] = func(l, slope, intercept)
m = m+1
x_m = []
y_m = []
x_error_m = []
y_error_m = []
#mn=min(len(rbase_m[i]),len(theta_m[i]))
mn=len(theta_m[i])
for j in range(mn):
x_m.append(1/rbase_m[i][j])
x_error_m.append((rbase_m[i][j]**(-2))*error_rbase_m[i][j])
y_m.append(cos(radians(theta_m[i][j])))
y_error_m.append(cos(radians(theta_m[i][j]))*radians(errortheta_m[i][j]))
slope, intercept, delete1, delete2, delete3 = stats.linregress(x_m,y_m)
slopes_all_m.append(slope)
intercepts_all_m.append(intercept)
m=0
l_m=arange(0,1.3,0.1)
yline_m=np.zeros(len(l_m))
for l in l_m:
yline_m[m] = func(l, slope, intercept)
m = m+1
x_s = []
y_s = []
x_error_s = []
y_error_s = []
#mn=min(len(rbase_s[i]),len(theta_s[i]))
mn=len(theta_s[i])
for j in range(mn):
x_s.append(1/rbase_s[i][j])
x_error_s.append((rbase_s[i][j]**(-2))*error_rbase_s[i][j])
y_s.append(cos(radians(theta_s[i][j])))
y_error_s.append(cos(radians(theta_s[i][j]))*radians(errortheta_s[i][j]))
slope, intercept, delete1, delete2, delete3 = stats.linregress(x_s,y_s)
slopes_all_s.append(slope)
intercepts_all_s.append(intercept)
m=0
#for l in max(x_s):
l_s=arange(0,1.3,0.1)
yline_s=np.zeros(len(l_s))
for l in l_s:
yline_s[m] = func(l, slope, intercept)
m = m+1
if intercept<0:
signtext='x'
else:
signtext='x+'
#plot of the fitted lines
#line2, = ax.plot(x_w, y_w,'c^',markersize=8,label='Water Peak, y = '+str(round(slopes_all_w[k],2))+signtext+str(round(intercepts_all_w[k],2)),linewidth=0.9)
#line3, =ax.plot(x_m, y_m,'bo',label='Middle Point, y = '+str(round(slopes_all_m[k],2))+signtext+str(round(intercepts_all_m[k],2)),linewidth=0.9)
#line4, =ax.plot(x_s, y_s,'gs',label='SAM Peak, y = '+str(round(slopes_all_s[k],2))+signtext+str(round(intercepts_all_s[k],2)),linewidth=0.9)
matplotlib.rcParams['legend.markerscale'] = 1.5
#plot of the data points
line2, = ax.plot(l_w, yline_w,'c',label='Water Peak, y = '+str(round(slopes_all_w[k],2))+signtext+str(round(intercepts_all_w[k],2)),linewidth=0.9)
line3, = ax.plot(l_m, yline_m,color='orange',label='Middle Point, y = '+str(round(slopes_all_m[k],2))+signtext+str(round(intercepts_all_m[k],2)),linewidth=0.9)
line4, = ax.plot(l_s, yline_s,'g',label='SAM Peak, y = '+str(round(slopes_all_s[k],2))+signtext+str(round(intercepts_all_s[k],2)),linewidth=0.9)
#plot of a black line through y=0
zeropoints=np.zeros(len(l_w))
ax.plot(l_w, zeropoints,'k--')
#plots of errorbars
ax.errorbar(x_w, y_w,xerr=x_error_w, yerr=y_error_w, fmt='c.',markersize=8,label='Water Peak, y = '+str(round(slopes_all_w[k],2))+signtext+str(round(intercepts_all_w[k],2)),linewidth=0.9)
ax.errorbar(x_m, y_m,xerr=x_error_m, yerr=y_error_m, fmt='.',color='orange' ,label='Middle Point, y = '+str(round(slopes_all_m[k],2))+signtext+str(round(intercepts_all_m[k],2)),linewidth=0.9)
ax.errorbar(x_s, y_s,xerr=x_error_s, yerr=y_error_s, fmt='g.',label='SAM Peak, y = '+str(round(slopes_all_s[k],2))+signtext+str(round(intercepts_all_s[k],2)),linewidth=0.9)
#other options for errorbars: ecolor='red',elinewidth=1.5, color='red',markeredgewidth=1.5
ax.set_xlim([-0.1,1.1])
if i==0:
ax.set_ylim([-0.95,-0.55])
elif i==5:
ax.set_ylim([-0.85,-0.55])
elif i==11:
ax.set_ylim([-0.6,-0.3])
elif i==17:
ax.set_ylim([-0.45,-0.15])
elif i==33:
ax.set_ylim([0.22,0.52])
# Set common labels
ax.set_ylabel(r'$cos(\theta_{mic})$ ',fontsize=15)
ax.set_xlabel('${R \ _{BASE}}^{-1}\ [ nm ^{-1} ]$',fontsize=13)
#titles for each subplot:
mysubtitle=ax.set_title('SAM '+str(i)+'%',fontweight='bold',fontsize=14)
plt.setp(mysubtitle, color='darkgreen') #set the color of title to white
matplotlib.rcParams['legend.markerscale'] = 0.8
#plot of pressure tensor point
line5, =ax.plot(0,cos(ptensor[k]),'ro',markersize=10, label="Pressure Tensor")
# Create a legend for the first line.
first_legend = plt.legend(handles=[line2,line3,line4,line5], loc=1,borderaxespad=0.)
# Add the legend manually to the current Axes.
ax = plt.gca().add_artist(first_legend)
# Set size of subplots
fig.subplots_adjust(top=4.5)
#plt.grid(True)
k = k + 1
#r'$cos(\theta_{mic})$ vs 1/R$\ _{BASE} $'
titletext='On the Same Scale: '+ r'$cos(\theta_{mic})$' +' vs 1/R$\ _{BASE} $ for Three Definitions \n OF $z=0$ Together with Pressure Tensor Results'
mytitle = plt.suptitle(titletext, fontsize=20, fontweight='bold', x=1.0, y=4.7)
plt.show()
#fig.savefig('scaled_errors_all_cos_r.jpg',bbox_extra_artists=(first_legend,mytitle,), bbox_inches='tight')
print slopes_all_w
print intercepts_all_w
print len(slopes_all_w), len(intercepts_all_w)
print slopes_all_m
print intercepts_all_m
print len(slopes_all_m), len(intercepts_all_m)
print slopes_all_s
print intercepts_all_s
print len(slopes_all_s), len(intercepts_all_s)
# WE CALCULATE THE MACROSCOPIC CONTACT ANGLES (theta_mac_w in radians) AND THE LINE TENSIONS (sigma_w)
theta_mac_w=np.zeros(len(intercepts_all_w))
sigma_w=np.zeros(len(slopes_all_w))
for i in range(len(intercepts_all_w)):
theta_mac_w[i]=arccos(intercepts_all_w[i])
sigma_w[i]=(-52.7)*slopes_all_w[i]
print theta_mac_w
print sigma_w
theta_mac_m=np.zeros(len(intercepts_all_m))
sigma_m=np.zeros(len(slopes_all_m))
for i in range(len(intercepts_all_m)):
theta_mac_m[i]=arccos(intercepts_all_m[i])
sigma_m[i]=(-52.7)*slopes_all_m[i]
print theta_mac_m
print sigma_m
theta_mac_s=np.zeros(len(intercepts_all_s))
sigma_s=np.zeros(len(slopes_all_s))
for i in range(len(intercepts_all_s)):
theta_mac_s[i]=arccos(intercepts_all_s[i])
sigma_s[i]=(-52.7)*slopes_all_s[i]
print theta_mac_s
print sigma_s
x=sigma_w
y=theta_mac_w
print "x=",x
print "y=",y
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(x,y,'o-')
y_pi = y/np.pi
y_tick,y_label=create_pi_labels(0.4, 0.8, 0.1) # DON'T CHANGE!!!!!!!!!!
#print y_tick
#print y_label
ax.set_yticks(y_tick)
ax.set_yticklabels(y_label, fontsize=20)
ax2 = ax.twinx()
ax2.set_yticks(ax.get_yticks())
ax2.set_ylim((1.199,2.6)) # DON'T CHANGE!!!!!!!!!!
ax.set_ylabel(r'$\theta_{mac}$ [rad]',fontsize=15)
ax.set_xlabel('$\sigma$ [pN]',fontsize=15)
mytitle = plt.suptitle(r'Macroscopic Contact Angle $\theta_{mac}$ vs Line Tension $\sigma $', fontsize=19, fontweight='bold')
#plt.grid(which='major', axis='both') #(use grid if numbers are changed)
plt.show()
fig.savefig('theta_mac_sigma_w.jpg',bbox_extra_artists=(first_legend,mytitle,), bbox_inches='tight')
#plots without complete wetting results
# Two subplots, unpack the axes array immediately
fig, axarr = plt.subplots(2, sharex=True)
# we mark the zero point with a line
zerox=range(36)
linezero=np.zeros(36)
axarr[1].plot(zerox,linezero,'k-')
# we mark the 90 deg. point with a line for the contact angle
zerox=range(36)
lineninety=36*[90]
axarr[0].plot(zerox,lineninety,'k-')
axarr[0].plot(SAMs,degrees(theta_mac_w),'c^--')
axarr[0].plot(SAMs,degrees(theta_mac_m),'o--', color='orange')
axarr[0].plot(SAMs,degrees(theta_mac_s),'gs--')
mytitle1=axarr[0].set_title('Macroscopic Cotact Angle',fontsize=16, fontweight='bold')
axarr[1].plot(SAMs,sigma_w,'c^--',label="Water Peak")
axarr[1].plot(SAMs,sigma_m,'o--', color='orange',label="Middle Point")
axarr[1].plot(SAMs,sigma_s,'gs--',label="SAM Peak")
axarr[1].set_title('Line Tension',fontsize=16, fontweight='bold')
axarr[0].set_ylabel(r'$\theta_{mac}$ [deg]',fontsize=15)
axarr[1].set_ylabel('$\sigma$ [pN]',fontsize=15)
axarr[1].set_xlabel('% OH- coverage percentage',fontsize=13)
first_legend=axarr[1].legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)
plt.show()
fig.savefig('subplt_alltheta_mac_sigma.jpg',bbox_extra_artists=(first_legend,mytitle1,), bbox_inches='tight')
# we add the results of SAM 50% and SAM 60% to sigma (in sigma2) and to theta_mac (in theta_mac2)
# and change all the types to list (incl. percentages-> percentages2)
sigma2_w=list(sigma_w)
sigma2_w=sigma2_w+[0,0]
print sigma2_w
theta_mac2_w=list(theta_mac_w)
theta_mac2_w=theta_mac2_w+[0,0]
print theta_mac2_w
sigma2_m=list(sigma_m)
sigma2_m=sigma2_m+[0,0]
print sigma2_m
theta_mac2_m=list(theta_mac_m)
theta_mac2_m=theta_mac2_m+[0,0]
print theta_mac2_m
sigma2_s=list(sigma_s)
sigma2_s=sigma2_s+[0,0]
print sigma2_s
theta_mac2_s=list(theta_mac_s)
theta_mac2_s=theta_mac2_s+[0,0]
print theta_mac2_s
percentages2=list(percentages)
print percentages2
# plots with complete wetting results AND with pressure tensor results
# Two subplots, unpack the axes array immediately
fig, axarr = plt.subplots(2, sharex=True)
# we mark the zero point with a line for the line tension
zerox=range(71)
linezero=np.zeros(71)
axarr[1].plot(zerox,linezero,'k-')
# we mark the 90 deg. point with a line for the contact angle
zerox=range(71)
lineninety=71*[90]
axarr[0].plot(zerox,lineninety,'k-')
axarr[0].plot(percentages2,degrees(theta_mac2_w),'c^--',label='Droplet Method: equal for \n the three z=0 defintions')
#axarr[0].plot(percentages2,degrees(theta_mac2_m),'o--', color='orange',label='Middle Point: Droplet Method')
#axarr[0].plot(percentages2,degrees(theta_mac2_s),'gs--',label='SAM Peak: Droplet Method')
mytitle1=axarr[0].set_title('Macroscopic Cotact Angle',fontsize=16, fontweight='bold')
line2, =axarr[0].plot(percentages2,ptensor,'rs--',label='Pressure Tensor Method')
axarr[1].plot(percentages2,sigma2_w,'c^--',label="Water Peak")
axarr[1].plot(percentages2,sigma2_m,'o--',color='orange',label="Middle Point")
axarr[1].plot(percentages2,sigma2_s,'gs--',label="SAM Peak")
axarr[1].set_title('Line Tension',fontsize=16, fontweight='bold')
axarr[0].set_ylabel(r'$\theta_{mac}$ [deg]',fontsize=15)
axarr[1].set_ylabel('$\sigma$ [pN]',fontsize=15)
axarr[1].set_xlabel('% OH- coverage percentage',fontsize=13)
first_legend=axarr[1].legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)
second_legend=axarr[0].legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)
plt.show()
fig.savefig('subplt2_theta_mac_sigma.jpg',bbox_extra_artists=(first_legend,second_legend,mytitle1,), bbox_inches='tight')
x2_w=sigma_w
y2_w=theta_mac_w
x2_m=sigma_m
y2_m=theta_mac_m
x2_s=sigma_s
y2_s=theta_mac_s
print "x=",x
print "y=",y
fig = plt.figure()
ax1 = fig.add_subplot(121)
ax1.plot(x_w,y_w,'c^-')
ax1.plot(x_m,y_m,'o-',color='orange')
ax1.plot(x_s,y_s,'gs-')
ax2 = fig.add_subplot(122)
ax2.plot(x2_w,y2_w,'c^-',label="Water Peak")
ax2.plot(x2_m,y2_m,'o-',color='orange',label="Middle Point")
ax2.plot(x2_s,y2_s,'gs-',label="SAM Peak")
#y_pi = y/np.pi
#y_tick,y_label=create_pi_labels(0.4, 0.8, 0.1) # DON'T CHANGE!!!!!!!!!!
#print y_tick
#print y_label
#ax.set_yticks(y_tick)
#ax.set_yticklabels(y_label, fontsize=20)
ax1.set_ylabel(r'$\theta_{mac}$ [rad]',fontsize=15)
ax1.set_xlabel('$\sigma$ [pN]',fontsize=15)
ax2.set_xlabel('$\sigma$ [pN]',fontsize=15)
first_legend=ax2.legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)
mytitle = plt.suptitle(r'Macroscopic Contact Angle $\theta_{mac}$ vs Line Tension $\sigma $', fontsize=19, fontweight='bold')
#plt.grid(which='major', axis='both') #(use grid if numbers are changed)
fig.savefig('theta_mac_sigma2.jpg',bbox_extra_artists=(first_legend,mytitle,), bbox_inches='tight')
plt.show()